You are here

function views_element_validate_integer in Views (for Drupal 7) 7.3

Helper form element validator: integer.

The problem with this is that the function is private so it's not guaranteed that it might not be renamed/changed. In the future field.module or something else should provide a public validate function.

See also

_element_validate_integer_positive()

2 string references to 'views_element_validate_integer'
ViewsUiBaseViewsWizard::build_form in plugins/views_wizard/views_ui_base_views_wizard.class.php
For AJAX callbacks to build other elements in the "show" form.
views_plugin_style_grid::options_form in plugins/views_plugin_style_grid.inc
Render the given style.

File

includes/admin.inc, line 419
Provides the Views' administrative interface.

Code

function views_element_validate_integer($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || abs($value) != $value)) {
    form_error($element, t('%name must be a positive integer.', array(
      '%name' => $element['#title'],
    )));
  }
}