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.
Hello, I have a simi-complicated form that is using Vertical Tab styling and the Multistep module. On each step I have several fieldgroups exposed as tabs. In the fieldgroups there are required fields.
If I click on next, to go to the next step in the form, require fields from the currently displayed tab are highlighted/validated. But the required fields from tabs that are not currently displayed, are not validated.
Maybe this behavior is by design and should be categorized as a feature request.
thanks, tom
Comment | File | Size | Author |
---|---|---|---|
#7 | vertical_tabs_support-1153166-7.patch | 3.12 KB | mjpa |
#4 | hidden_elements-1153166-4.patch | 2.46 KB | mjpa |
Comments
Comment #1
attiks CreditAttribution: attiks commentedthis is by design, only visible fields are checked
Comment #2
tomdavidson CreditAttribution: tomdavidson commentedMakes sense. Perhaps the feature request should be with multi-step to step through tabs, but that doesn't seem to quite fit either.
Thanks
Comment #3
attiks CreditAttribution: attiks commentedComment #4
mjpa CreditAttribution: mjpa commentedRather than closing a feature request issue, it'd be nice if the feature request was implemented.
I've included a patch to add a textarea to the admin page that allows you to specify the form IDs that should have hidden elements validated, if a form ID isn't listed then it'll keep the current behaviour - that is hidden elements will be ignored.
Comment #5
attiks CreditAttribution: attiks commented@mjpa, thanks for the patch, we'll try to implement it asap
Comment #6
Jelle_Spatch tested added to both dev branches, thanks mjpa
Comment #7
mjpa CreditAttribution: mjpa commentedShould probably have included these changes with the original patch but thought they could be done outside of this module. Turns out it's not that easy... so here's another patch. The patch basically does the following 2 things:
1. Adds the error/valid classes to the actual tabs so a user can tell that a tab has errors inside it.
2. Sets focus to the first tab with errors, unless the current tab itself has errors.
Comment #8
Jelle_Spatch committed to the dev branch.
I also added an other setting to validate all input fields of vertical tabs (even the hidden ones) as standard, people can disable it if they want to. All other hidden fields are ignored.
Comment #9
mjpa CreditAttribution: mjpa commentedLooks good to me (D7 version anyway). Close issue?
Comment #10
attiks CreditAttribution: attiks commentedwe'll make a new release tomorrow
Comment #11
Jelle_Sfixed in 7.x-1.16