You are here

function accordion_speed_validate in Views Accordion 6

Validates the options entered

1 string reference to 'accordion_speed_validate'
views_accordion_style_plugin::options_form in ./views_accordion_style_plugin.inc

File

./views_accordion_style_plugin.inc, line 181
Provide an accordion style plugin for Views. This file is autoloaded by views.

Code

function accordion_speed_validate($element, &$form_state) {

  /* must be numeric value */
  if (!is_numeric($element['#value'])) {
    form_error($element, '<em>' . ($element['#title'] . t('</em> must be a <em>numberic</em> value.')));
  }

  /* dont allow commas */
  if (strstr($element['#value'], ',')) {
    form_error($element, t('Please use a "." instead of a "," in the <em>') . $element['#title'] . t('</em> field.'));
  }

  /* must be higher than 0 */
  if ($element['#value'] <= 0) {
    form_error($element, '<em>' . ($element['#title'] . t('</em> must be a <em>number</em> higher than 0.<br />If you would like it to be instanteneous, enter 0.001')));
  }
}