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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attiks’s picture

Category: bug » feature

this is by design, only visible fields are checked

tomdavidson’s picture

Makes sense. Perhaps the feature request should be with multi-step to step through tabs, but that doesn't seem to quite fit either.
Thanks

attiks’s picture

Status: Active » Closed (works as designed)
mjpa’s picture

Status: Closed (works as designed) » Needs review
FileSize
2.46 KB

Rather 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.

attiks’s picture

Assigned: Unassigned » Jelle_S

@mjpa, thanks for the patch, we'll try to implement it asap

Jelle_S’s picture

Status: Needs review » Fixed

patch tested added to both dev branches, thanks mjpa

mjpa’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Fixed » Needs review
FileSize
3.12 KB

Should 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.

Jelle_S’s picture

patch 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.

mjpa’s picture

Looks good to me (D7 version anyway). Close issue?

attiks’s picture

Status: Needs review » Reviewed & tested by the community

we'll make a new release tomorrow

Jelle_S’s picture

Status: Reviewed & tested by the community » Fixed

fixed in 7.x-1.16

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.