You are here

function uc_coupon_uc_cart_checkout_validate in Ubercart Discount Coupons 6

Validation handler for uc_cart_checkout. Used to clear checkout form validation errors when the "Apply to order" button is clicked and JS is disabled.

uc_coupon_submit() uc_coupon_uc_cart_checkout_submit()

1 string reference to 'uc_coupon_uc_cart_checkout_validate'
uc_coupon_form_uc_cart_checkout_form_alter in ./uc_coupon.module
Implementation of hook_form_FORM_ID_alter() for uc_cart_checkout_form().

File

./uc_coupon.module, line 1095
Provides discount coupons for Ubercart.

Code

function uc_coupon_uc_cart_checkout_validate($form, $form_state) {

  // Clear all form errors only when the "Apply Coupon" button is clicked (and JS is disabled).
  if (preg_match('/coupon-apply$/', $form_state['clicked_button']['#id'])) {
    form_set_error(NULL, '', TRUE);
    drupal_get_messages('error');
  }
}