Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem / Motivation:
With ife making it to core, it is important to match the markup used in Core (both with and without IFE) to ensure errors don't pile up for the same field when a clientside validation shown for a field having an error from server side (after submitting the form)
Proposed solution:
Match the markup for the error label/div to match the one in core by default and allow it to be overridden the way it is allowed in core. This way code to remove existing errors before showing the new one will remove the ones provided by IFE / Core after form submit before showing the new error.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2906132-7.patch | 2.68 KB | nikunjkotecha |
Comments
Comment #2
Jelle_SWe did this for Drupal 7 and ended up with a ton of submodules and hard to maintain code. We decided for D8 to leverage the plugin system for custom validation requirements, which means it's up to the contrib modules to decide whether or not they want to support Clientside Validation. Unless @attiks disagrees with me of course
Comment #3
nikunjkotechaI'm working on custom patch right now for this and wanted to detail out in description later tonight.
Currently the only issue that I face and I feel should be fixed is to ensure two messages are not displayed. We need to allow hooking into the JS options in a way that other modules can modify the error message markup and also to take some action if required.
For instance, in this current case - I get div.form-item--error-message from inline_form_errors and then clientside_validation module adds label.error and to end user both are displayed.
Hope this makes sense, for sure we can change the ticket to allow hooking into clientside_validation module to make it more relevant.
Comment #4
nikunjkotechaAdding basic patch to fix UI bug mentioned above.
Comment #5
nikunjkotechaComment #6
nikunjkotechaComment #7
nikunjkotechaDid two things in this patch:
@Jelle_S: Possible to review this one?
Comment #9
nikunjkotechaUpdated the code, moved ife related stuff to separate js file and in the main file added only the event trigger to allow any module to update options. This is more extensible now and supports ife like ckeditor.