You are here

function commerce_coupon_handler_area_cart_form::options_validate in Commerce Coupon 7

Same name and namespace in other branches
  1. 7.2 includes/views/handlers/commerce_coupon_handler_area_cart_form.inc \commerce_coupon_handler_area_cart_form::options_validate()

Validate the options form.

Overrides views_handler::options_validate

File

includes/views/handlers/commerce_coupon_handler_area_cart_form.inc, line 104
Displays a commerce coupon form field item on cart's form:

Class

commerce_coupon_handler_area_cart_form
@file Displays a commerce coupon form field item on cart's form:

Code

function options_validate(&$form, &$form_state) {
  $weight = $form_state['values']['options']['weight'];

  // Weight must be an integer:
  if (!is_null($weight) && !is_numeric($weight) || (int) $weight != $weight) {
    form_set_error('options][weight', t('!name field must be an integer.', array(
      '!name' => $form['weight']['#title'],
    )));
  }
}