the hook_validate on the last step is skipped in the example module.
The validation trigger is only bound on the next button (not the submit button).
changing
// Include each validation function defined for the different steps.
if (function_exists($form_state['step_information'][$step]['form'] . '_validate')) {
$form['next']['#validate'] = array($form_state['step_information'][$step]['form'] . '_validate');
}
to
// Include each validation function defined for the different steps.
if (function_exists($form_state['step_information'][$step]['form'] . '_validate')) {
$form['next']['#validate'] = array($form_state['step_information'][$step]['form'] . '_validate');
$form['finish']['#validate'] = array($form_state['step_information'][$step]['form'] . '_validate');
}
will fire the validation for last form too
Comments
Comment #1
rfayA patch would be appreciated. Thanks!
Comment #2
strykaizerSorry, must've been in a rush when I posted the issue.
Attached you'll find a patch for 8.x version
Comment #3
rfayWe aren't doing 8.x-1.x stuff yet until people step up to port the 7.x-1.x modules over.
So if this is a 7.x-1.x problem... please provide a 7.x patch.
Thanks!
Comment #4
strykaizerNo problem, attached you'll find a patch for 7.x version
Comment #5
strykaizermarking this as needs review
Comment #6
mile23It seems that there's no validation function for the Finish button, and the Finish button is only added when we're on the last page of the wizard.
So therefore we don't need to (and probably shouldn't) add a validation handler to the form array for all the pages.
If you'd like to modify the example so that it shows validation of the final page, that'd be great. It could do a simple check on whether the user entered an SSN or not, for instance.
Thanks.
Comment #7
mile23