Passing info back to form from validate

by pandroid   Last Updated January 13, 2018 11:07 AM

Drupal 7. I have a vertical tabbed form. On tabbed one pane I list a bunch of records from the database, and each has an 'edit' button against it. The buttons are wired to a Bootstrap accordion, which when clicked drops down the details of the particular record for users to amend. My problem is that when the user submits the form, if an amendment breaks validation, I need to send back to the form which record is at fault, so that I can automatically open the right part of the accordion.(The accordion is normally closed).

If I use form_set_error in the validation routine I cant find a way to pass back to the browser information on which record is at fault. I've tried adding it to form state['storage'], tried overwriting the value of a hidden field neither of which works.

I use form_state['rebuild'] = true in the validation routine - this allows me to open the right pane in the vertical tabbed form, but I cant find a way to pass the element id back.

I need to do this in the validation routine. The form doesn't get as far as submitting.

(Once I get the element id, I can use jquery to open the right accordion pane).

Any ideas?

Tags : forms


Related Questions




Reuse form from another module in multistep form

Updated May 21, 2015 22:03 PM