function comment_delete_settings_form_validate in Comment Delete 7
Same name and namespace in other branches
- 6 comment_delete.admin.inc \comment_delete_settings_form_validate()
Validation callback for comment deletion settings form.
File
- ./
comment_delete.admin.inc, line 49 - comment_delete.admin.inc
Code
function comment_delete_settings_form_validate($form, &$form_state) {
// Check threshold is numerical value.
if (!is_numeric($form_state['values']['comment_delete_threshold'])) {
form_set_error('comment_delete_threshold', t('Threshold should be greater than or equal to zero (0).'));
}
// Check threshold is not negative.
if ($form_state['values']['comment_delete_threshold'] < 0) {
form_set_error('comment_delete_threshold', t('Threshold should be greater than or equal to zero (0).'));
}
// Check threshold does not include decimals.
if (preg_match('/\\./i', $form_state['values']['comment_delete_threshold'])) {
form_set_error('comment_delete_threshold', t('Threshold should not include decimals.'));
}
}