You are here

function uc_product_add_to_cart_form_validate in Ubercart 5

Same name and namespace in other branches
  1. 7.3 uc_product/uc_product.module \uc_product_add_to_cart_form_validate()

Allow only positive, numeric quantities.

File

uc_product/uc_product.module, line 2362
The product module for Ubercart.

Code

function uc_product_add_to_cart_form_validate($form_id, $form_values) {
  if (!is_numeric($form_values['qty']) || intval($form_values['qty']) <= 0) {
    form_set_error('qty', t('You have entered an invalid quantity.'));
  }
}