Custom Widget for Dynamic Field Validation
Summary:
Need to make a text field required ONLY if a specific dropdown menu value is selected
Content (required):
Hi there,
Need to make a text field required ONLY if a specific dropdown menu value is selected.
There are 2 custom widgets involved, one for the select control (fires the rightnow event on selection), and the other for the text field that needs to be required only if the "other" option is selected (listens to the event)
The only functionality that is being executed is setting
this.data.attrs.required = true;
or
this.data.attrs.required = false;
If you inspect the element (text field) after the event, the required attribute gets properly set, however this alone is not enough to trigger the post submission required validation.
Tagged:
0