Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.