Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_commerce_checkout_pane_info_alter
- */
- function checkout_forms_commerce_checkout_pane_info_alter(&$checkout_panes) {
- if(isset($checkout_panes['customer_profile_appointment_d'])){
- $checkout_panes['customer_profile_appointment_d']['callbacks']['checkout_form_validate'] = 'checkout_forms_commerce_checkout_form_validate';
- }
- }
- /**
- * Checkout pane validation override to validate customer profile and appointment
- */
- function checkout_forms_commerce_checkout_form_validate($form, &$form_state, $checkout_pane, $order) {
- $first_name = $form_state['values']['customer_profile_appointment_d']['field_first_name_']['und'][0]['value'];
- $last_name = $form_state['values']['customer_profile_appointment_d']['field_last_name']['und'][0]['value'];
- //Some validation tests ... kept it simple for brevity.
- if (is_numeric($first_name)) {
- form_set_error(customer_profile_appointment_d . '][field_first_name_', t('Numeric characters are not allowed.'));
- }
- //Some validation tests ... kept it simple for brevity.
- if (is_numeric($last_name)) {
- form_set_error('customer_profile_appointment_d][field_last_name', t('Numeric characters are not allowed.'));
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement