You are here

function _element_validate_integer_positive in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/content.admin.inc \_element_validate_integer_positive()

Helper form element validator : integer > 0.

4 string references to '_element_validate_integer_positive'
nodereference_widget_settings in modules/nodereference/nodereference.module
Implementation of hook_widget_settings().
text_field_settings in modules/text/text.module
Implementation of hook_field_settings().
text_widget_settings in modules/text/text.module
Implementation of hook_widget_settings().
userreference_widget_settings in modules/userreference/userreference.module
Implementation of hook_widget_settings().

File

includes/content.admin.inc, line 1944
Administrative interface for content type creation.

Code

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