You are here

function uc_product_actions_form_validator in Ubercart Product Actions 6

Same name and namespace in other branches
  1. 7 uc_product_actions.module \uc_product_actions_form_validator()

Validate the action form submission.

8 calls to uc_product_actions_form_validator()
uc_product_actions_update_active_action_validate in ./uc_product_actions.module
uc_product_actions_update_cost_action_validate in ./uc_product_actions.module
uc_product_actions_update_default_qty_action_validate in ./uc_product_actions.module
uc_product_actions_update_list_price_action_validate in ./uc_product_actions.module
uc_product_actions_update_sell_price_action_validate in ./uc_product_actions.module

... See full list

File

./uc_product_actions.module, line 330

Code

function uc_product_actions_form_validator($action, &$form_state) {
  $form_state['values'][$action . '_change'] = check_plain($form_state['values'][$action . '_change']);
  $method = $form_state['values'][$action . '_method'];
  if ($form_state['values'][$action . '_change'] == '') {
    form_set_error($action . '_change', t('Please enter a value.'));
  }
  elseif (!is_numeric($form_state['values'][$action . '_change'])) {
    form_set_error($action . '_change', t('Please enter a numerical value.'));
  }
  elseif (($method == 'percentage' || $method == 'difference') && $form_state['values'][$action . '_change'] == 0) {
    form_set_error($action . '_change', t('Please enter a non-zero value.'));
  }
}