Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am work on commerce pane, in hook_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) I call a function to do something in pane sumbit,

something like

function hook_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {

  do_update_something($user);
}

but when I am not fill another pane like address , my function called, How can I prevent submit when there is error (validation in another panes) in other panes?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

check errors before call your function

function hook_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
if (!(form_get_errors()){
 do_update_something($user);
}

}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.