This feels like it might be a lot of work to fix, but currently mandatory fields block the usage of the "previous page" button for paged forms. I'm guessing that each page is validating every time the user hits Next or Previous? The browser's Back button seems to work (at least on Firefox), but this is still likely to confuse people.
Having the form validate only at submit time might be a pain to implement, in the case where there are invalid fields on more than one page... But maybe a compromise would be to only validate on Next, and not on Previous - since the user will have to Next his way through all pages before submitting anyway.
Anyway, for now I'm going back to a one-page form.
Comments
Comment #1
quicksketchYes, unfortunately this is a very difficult problem to fix. Drupal performs the mandatory field validation separate from everything else, and Webform doesn't get a chance to tell Drupal not to validate required fields. To make this work, Webform would need to individually theme every form element to give it the required "*" on output next to the label, but not actually make the field required. Then do a separate validation check to validate required fields. :P
The whole thing is quite ugly, I think it's something we might need to deal with until it's easier to override in Drupal core.
Comment #2
gvdvenis commentedComment #3
willeaton commentedHave you tried the form API...
'#executes_submit_callback' => 'FALSE',
for button fields? If nothing else you can try and just make this a javascript back button using "drupal_add_js()" and make the "return" false. That way you can do an onclick= history(-1). If someone doesnt have javascript enabled then they are just faced with the same problem and nothing is broken.
I hope that helps in solving it quicker, it is quite annoying :-)
Thanks
Will
Comment #4
quicksketchIf the submit callback is not submitted, then any values the user has submitted on that page are not saved. This would basically be replacing an existing problem with a different one.
Comment #5
platypus media commentedThis is also a problem in D6
Comment #6
dldege commentedI have a work around that might be able to be worked in to a real patch for this issue.
In my additional form validation I added
the idea is simple - on the back button I unset all the form_errors rather then trying to find a way to bypass validation.
Comment #7
mbaizman commentedThis is a great workaround. Verified.
Comment #8
quicksketchLet's move this to #588354: no validation for prev button
Comment #9
miro_dietikerCan you please add this as a patch for the module?
Would be great...
Comment #10
eloiguell commented#6 dldege-->It works for Drupal 6. In Drupal 5 I have fixed it this way:
1.-In my additional form validation I added
2.- Change the form_set_error function:
Thanks dldege!!
Comment #11
hendrakieran commentedComment #12
hendrakieran commented@ #6: Is there anywhere within the module that reset this values (after your code unset them)? My concern is that the values remain unset for the remaining of the form. In my test, clicking on the "Next Page >" button (after I clicked the Previous button) on a mandatory component is possible without entering anything. So this may have overwrites the mandatory rule on that component.