public function CommerceShippingExample::submit_form_validate in Commerce Shipping 7
Submit form validation callback: validates data entered via our custom submit form elements. Failed validation requires a FALSE return value. Otherwise nothing needs to be returned.
Overrides CommerceShippingQuote::submit_form_validate
File
- modules/
plugins/ quotes/ example_plugin/ CommerceShippingExample.class.php, line 63
Class
Code
public function submit_form_validate($pane_form, $pane_values, $form_parents = array(), $order = NULL) {
// Throw an error if a long enough name was not provided.
if (strlen($pane_values['name']) < 2) {
form_set_error(implode('][', array_merge($form_parents, array(
'name',
))), t('You must enter a name two or more characters long.'));
// Even though the form error is enough to stop the submission of the form,
// it's not enough to stop it from a Commerce standpoint because of the
// combined validation / submission going on per-pane in the checkout form.
return FALSE;
}
}