Here are the steps to add a custom validation to the UI Form field:
- Add the following code to your field in xml file:
<item name="validation" xsi:type="array">
<item name="custom_auth_validation" xsi:type="boolean">true</item>
</item> Then add the following code to your js while which is loading on that page:
validator.addRule(
'custom_validation',
function (value) {
if (jQuery( "input[name='authorization_required']" ).val() == 1
&& jQuery( "input[name='auth_code']" ).val() == "") {
return false;
}
return true;
}
,$.mage.__('Custom validation message...')
);
Comments
Post a Comment