You are here

function filtersie_numericInput_validate in FiltersIE 7

Validate input type number (int, float or double).

2 string references to 'filtersie_numericInput_validate'
filtersie_generic_form in ./filtersie.admin.inc
Generic kernel convolution config form.
filtersie_sharpenUSM_form in ./filtersie.admin.inc
Sharpen (using Unsharp masking technique) config form.

File

./filtersie.admin.inc, line 169
Admin filters config pages.

Code

function filtersie_numericInput_validate($element, &$form_state) {
  $value = empty($element['#allow_negative']) ? $element['#value'] : preg_replace('/^-/', '', $element['#value']);
  if ($element['#value'] != '' && !is_numeric($value)) {
    if (empty($element['#allow_negative'])) {
      form_error($element, t('!name must be a number.', array(
        '!name' => $element['#title'],
      )));
    }
    else {
      form_error($element, t('!name must be a positive number.', array(
        '!name' => $element['#title'],
      )));
    }
  }
}