function rooms_element_validate_integer_zero_positive in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Form element validation handler for integer elements greater than or equal to 0.
1 string reference to 'rooms_element_validate_integer_zero_positive'
- rooms_booking_children_discount in modules/
rooms_booking/ rooms_booking.module - Form callback for rooms_booking_children_discount form.
File
- ./
rooms.module, line 1316 - Provides basic underlying functionality and configuration options used by all Rooms modules
Code
function rooms_element_validate_integer_zero_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'],
)));
}
}