You are here

function acquia_lift_percentage_validate in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.module \acquia_lift_percentage_validate()

Element validator for acquia_lift_percentage custom element.

Values submitted as percentages must be numbers between 0 and 100. It is assumed that the value is already validated as a number.

See also

acquia_lift_element_info().

1 string reference to 'acquia_lift_percentage_validate'
acquia_lift_element_info in ./acquia_lift.module
Implements hook_element_info().

File

./acquia_lift.module, line 452
acquia_lift.module Provides Acquia Lift-specific personalization functionality.

Code

function acquia_lift_percentage_validate($element, &$form_state) {
  $value = $element['#value'];
  if ($value < 0 || $value > 100) {
    form_error($element, t('%name must be a number between 0 and 100.', array(
      '%name' => $element['#title'],
    )));
  }
}