function linkit_isnumeric_validate in Linkit 7.2
Same name and namespace in other branches
- 7.3 plugins/export_ui/linkit_profiles.inc \linkit_isnumeric_validate()
Element validate callback for fields that should be numeric.
1 string reference to 'linkit_isnumeric_validate'
- linkit_profiles_export_ui_form in plugins/
export_ui/ linkit_profiles.inc - Generate a profile form.
File
- plugins/
export_ui/ linkit_profiles.inc, line 147
Code
function linkit_isnumeric_validate($element, &$form_state, $form) {
if (!empty($element['#value']) && !is_numeric($element['#value'])) {
form_error($element, $element['#title'] . ' should only contains numbers.');
}
// Alter the value by typecasting into an integer.
$form_element =& $form_state['values'];
foreach ($element['#array_parents'] as $current) {
$form_element =& $form_element[$current];
}
$form_element = (int) $form_element;
}