By jlab on
Greetings all
I have lately stumbled upon this bookpage Dynamic and Multipage forms with Forms API
I have tried my best getting it working but it seems that I just can't get it working.
As soon as I add a hook_submit() function my submit button disapears.
Is there anyone here maybe willing to share some basic code using a multipage submit form.
The code snippets in the above example isn't complete and I have difficulty getting the whole idea.
I'm quite a noob when it comes to coding but I have coded a few projects in Drupal 4.7 without too much hassle.
Please if anyone can help me it would be greatly appreciated. I will also post my source code if anyone is interested.
Kind Regards Julz
Comments
Try looking at this instead...
Try looking at this instead; http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/exampl...
Else, yeah - post your code, it'll be easier to give you a proper answer that way rather than give you some generic answer which may not make sense to you.
Pobster
Example is for 4.7
I found looking at other v5 modules that use multipage the most help. Quickfile uses it for paypal integration so that is worth a look. Also found that the name of your data entry function seems to make a difference, it may have to be yourmodule_node_form not just yourmodule_form (if your module is node based!). I experimented with it months ago then got sidetracked. I would love to see a V5 example as v5 introduced the #multistep property for forms and the example in the handbook just did not work for me.
www.scryptik.com - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
Thanks
I will have a look through Quickfile as well...
Will post my code when I'm finnished...
Artificial Intelligence is no match against Natural Stupidity
Thanks
This looks like exactly what I wanted...
I'll browse through the code and check it out if I still fail I will upload my code.
Thanks for the link I really appreciate it.
Artificial Intelligence is no match against Natural Stupidity
validation on multipage forms
The quote above was taken from the "Dynamic and Multipage forms with Forms API" page http://drupal.org/node/101707
It does not make sense to me... Since it looks like the 'step' field which is a hidden field does not get passed to the "form_validate" function.
I tried reading through the forms API over the weekend and still could not quite figure out how to validate a hidden field.
And it seems useless building multistep forms in Drupal 5 if it is so difficult to validate the form.
Example of my form I'm working with:
How would I go about adding validation to this form?
Can I use external functions to generate the hidden form fields?
Artificial Intelligence is no match against Natural Stupidity
Found it
I solved the problem by adding '#base' attribute to my form.
and adding $form_id, $form_values parameters to my validate and submit functions.
If anyone wants example code please let me know and I will post it.
Since I was struggling a bit I was wondering if I could upload my my module somewhere for people to download and have a look at the example code.
Artificial Intelligence is no match against Natural Stupidity
Example code would be
Example code would be fantastic. I've been banging my head against this for a few weeks now, each time I think I've solved it I get a different error so if you've cracked it that would be brilliant!
Cheers,
Rich
Great work!
I took your code and added a submit button for the final step. Also made a validation for field3 on step 2 and it does not let you proceed until field is valid. Here are snippets of what I did:
I could put the code on my web dev site if that would help, but ideally it should be in the handbook here after getting a polish from a Drupal guru.
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy
The form validate has problem
I tried this code,It's working well when all the input data are valid.But If the input data is not valid, I must click next button twice, then go to next form.And if I click back button instead of next button the page would go back to form step 1.
Back Button Error
I'm new to Drupal, so I don't know if this is a known issue, new issue, or (probably) just something I am missing. When filling in the forms (using the code given), if the user presses the back button, the next time he/she presses the "Next" button the form will go back to step 1 of the form. I've had that problem with all three of the examples I've used and haven't found any discussions about it.