Problem/Motivation
Due to issues with jQuery validation, the number of forms that this module causes to break on our site is not insignificant. We could use the "Clientside Validation Enabled Forms" field if we choose to deselect the "Use Clientside Validation in all forms" checkbox. When dealing with a site of the complexity of ours, however, the number of forms we would have to explicitly identify to have the module validate would be significant. This configuration could go out of date when new entity types are added.
Thus, it would be ideal to be able to create two "Exceptions" form elements.
- One could be for field exceptions to be available whether validation runs on all or only specific forms
- One could be for form exceptions when "Use Clientside Validation in all forms" is checked
Proposed resolution
- A "Field exceptions" textfield added to the configuration form (`/admin/config/user-interface/clientside-validation`) and is always visible. Any field name added to the "Field exceptions" field, with one field name per line, results in the module not validating that field
- A "Form exceptions" textfield added to the configuration form (`/admin/config/user-interface/clientside-validation`), visible when "Use Clientside Validation in all forms" is checked. Any form id added to the "Form exceptions" field, with one form id per line, results in the module not validating that form.
User interface changes

- The "Field exceptions" textfield would be visible.
- The "Field exceptions" field should have help text that describes the purpose.

- The "Form exceptions" textfield would be visible when the "Use Clientside Validation in all forms" is checked.
- The "Form exceptions" field should have help text that describes the purpose.
- Should there be data in the "Form exceptions" textfield when the "Use Clientside Validation in all forms" is unchecked, that data should be removed when the configuration form is saved.
Implementation steps
- The config/schema/clientside_validation.schema.yml would need to be updated to add the two new config fields data mapping.
- The src/Form/ClientsideValidationSettingsForm.php would need to be updated to add the form fields.
- The clientside_validation.module would need to be updated.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | clientside-validation-settings-enabled-forms.jpeg | 210.99 KB | skyriter |
| #3 | clientside-validation-settings-all-forms.jpeg | 231.62 KB | skyriter |
Issue fork clientside_validation-3495738
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3495738-form-exceptions
changes, plain diff MR !23
- 3495738-add-a-configuration
changes, plain diff MR !22
Comments
Comment #2
skyriter commentedComment #3
skyriter commentedComment #4
skyriter commentedComment #5
swirtI like this idea very much. There have been a couple of sites I wanted to use this on, but validation was too greedy and broke a few forms. This addition would make it more useable for my use cases.
Comment #6
skyriter commentedComment #11
skyriter commentedThis issue was written without an understanding of what was already being done in https://www.drupal.org/project/clientside_validation/issues/2949540.
As a result, I added code over there to satisfy the need to both include and exclude forms.
I think now that this issue would be better scoped to only exclude fields (though having spent some time trying to do just that, I am stumped on how to do it).