The following code works for a textbox , I am able to override the default validator function with my own and force it to return false, making the input invalid. However this does not work at all with FilteringSelect inputs. The following code always returns true - in fact it never enters my custom validation function.
Which means it is executing a different validator than expected, OR I am setting the validator on the wrong input (there are multiple when rendered).
var customValidator = function (value) {
console.log("custom validator: ", value);
return false; //force an invalid result
};
formelement.theInput.set('validator', customValidator);
var res = formelement.theInput.validate();
console.log("res: ", res);
The widget template looks lke this
<div data-dojo-attach-point="formelement" >
<select data-dojo-type="dijit/form/FilteringSelect" data-dojo-attach-point="theInput"
data-dojo-props="labelAttr:'text', searchAttr:'text', required:false, " >
</select>
</div>
Which when rendered looks like this
<div data-dojo-attach-point="formelement" style="position: absolute; left: 222px; top: 75px; width: 200px; border-width: 1px; border-style: none; border-color: black;" class="fe-dropdown resize-handle" id="4180a54b-3931-472e-8c5f-212bfddc88b2" widgetid="uniqName_10_10">
<div class="dijit dijitReset dijitInline dijitLeft fe-element dijitTextBox dijitComboBox dijitValidationTextBox dijitTextBoxFocused dijitComboBoxFocused dijitValidationTextBoxFocused dijitFocused" id="widget_dijit_form_FilteringSelect_28" role="combobox" aria-haspopup="true" data-dojo-attach-point="_popupStateNode" widgetid="dijit_form_FilteringSelect_28" aria-disabled="false" popupactive="true" aria-expanded="false" aria-owns="dijit_form_FilteringSelect_28_popup">
<div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" data-dojo-attach-point="_buttonNode" role="presentation">
<input class="dijitReset dijitInputField dijitArrowButtonInner" value="▼ " type="text" tabindex="-1" readonly="readonly" role="button presentation" aria-hidden="true">
</div>
<div class="dijitReset dijitValidationContainer">
<input class="dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value="Χ " type="text" tabindex="-1" readonly="readonly" role="presentation">
</div>
<div class="dijitReset dijitInputField dijitInputContainer">
<input class="dijitReset dijitInputInner" type="text" autocomplete="off" data-dojo-attach-point="textbox,focusNode" role="textbox" aria-autocomplete="both" tabindex="0" id="dijit_form_FilteringSelect_28" aria-required="false" value="" aria-invalid="false" maxlength="25" style="font-family: Arial; font-weight: 400; font-style: normal; color: black; text-decoration: none; text-align: left; background-color: transparent;">
<input type="hidden" value="CA">
</div>
</div>
</div>