function statspro_settings_form_validate in Statistics Pro 6.2
Implementation of hook_modulename_validate() for settings form.
1 string reference to 'statspro_settings_form_validate'
- statspro_settings_form in ./
statspro_settings.inc - Form generating function for report settings.
File
- ./
statspro_settings.inc, line 90
Code
function statspro_settings_form_validate($form, &$form_state) {
$periods = statspro_get_period_items();
if (!in_array($form_state['values']['statspro_period'], array_keys($periods))) {
form_set_error('statspro_period', t('Unknown period %period.', array(
'%period' => $form_state['values']['statspro_period'],
)));
}
elseif ($form_state['values']['statspro_period'] == 'custom_days') {
if (!is_numeric($form_state['values']['statspro_custom_number_days'])) {
form_set_error('statspro_custom_number_days', t('You must set the a numeric value for the number of days for period %period.', array(
'%period' => $periods['custom_days'],
)));
}
elseif ($form_state['values']['statspro_custom_number_days'] < 0) {
form_set_error('statspro_custom_number_days', t('You must set a non negative number of days for period %period.', array(
'%period' => $periods['custom_days'],
)));
}
}
}