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

rfay’s picture

A patch would be appreciated. Thanks!

strykaizer’s picture

Version: 7.x-1.x-dev »
Assigned: Unassigned » strykaizer
Status: Active » Needs review
StatusFileSize
new669 bytes

Sorry, must've been in a rush when I posted the issue.
Attached you'll find a patch for 8.x version

rfay’s picture

Version: » 7.x-1.x-dev
Status: Needs review » Needs work

We 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!

strykaizer’s picture

No problem, attached you'll find a patch for 7.x version

strykaizer’s picture

Status: Needs work » Needs review

marking this as needs review

mile23’s picture

Status: Needs review » Needs work

It 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.

mile23’s picture

Status: Needs work » Closed (won't fix)