Excluding field by given condition

Consider the following example. It asks you about the Javascript framework you like most. You can choose one from the list of popular Javascript frameworks such as Angular, Ember, React, Vue.

If your favorite framework is not in the list, you must fill its name in a text box. You can use the callback validator to validate this input:

The logic inside the callback function is quite simple and easy to understand. The problem comes when you submit the form, the otherFramework field is marked as valid with a valid icon even if you choose a framework from the list. In that case, the otherFramework field should be completely ignored.

In order to fix that, we can use the excluded option provided by the Excluded plugin as following:


When the field validation is ignored, its container will not have the success class, and the associated icon isn't shown.