I created a module with 3 forms on it. Is there a way to only have one submit button at the very bottom of the page that will store all three values?
2 Answers
Not really. Drupal form may try to redirect you after successful submit. If 3 forms try, which redirect should work? And that's only one example.
Create fourth form function. In it, call all 3 existing ones, clean up mess with submit functions, validators and redirects, and it should work. Or simply merge your forms into one, why you needed three?
-
I'm trying to make multiple forms to separate a user's first name, last name, and email address. I guess I can just make a giant textarea instead of three separate textfields. Oct 7, 2014 at 17:06
-
1@Ryan whyyy?? You do not need 3 forms, you can have many fields on one form!– MołotOct 7, 2014 at 17:09
You could try the multiform module. This is especially useful if the forms you have on one page are not ones you created, but are instead Drupal forms you need to have on a single page.
This is an API module which lets you put several forms into one .
The usage is very simple: there is one API function to call: multiform_get_form() and you can pass the form names in the attribute list.
You can use it like this:
multiform_get_form(array('form_id', $arg1), array('form_id', $arg1, $arg2));