You are here

function editor_note_validate_float_positive_or_zero in Editor Notes 7

Validates form element that accepts float value and must be >= 0 or <= 1.

1 string reference to 'editor_note_validate_float_positive_or_zero'
editor_note_field_settings_form in ./editor_note.module
Implements hook_field_settings_form().

File

./editor_note.module, line 1377
Main functionality for Editor Notes module.

Code

function editor_note_validate_float_positive_or_zero($element, &$form_state) {
  $value = trim($element['#value']);
  if (!is_numeric($value) || $value < 0 || $value > 1) {
    form_error($element, t('%name must be between 0 and 1.', array(
      '%name' => $element['#title'],
    )));
  }
}