function forena_layout_form_validate in Forena Reports 7
Same name and namespace in other branches
- 6.2 forena.admin.inc \forena_layout_form_validate()
- 6 forena.admin.inc \forena_layout_form_validate()
- 7.2 forena.admin.inc \forena_layout_form_validate()
- 7.3 forena.admin.inc \forena_layout_form_validate()
1 string reference to 'forena_layout_form_validate'
- forena_layout_form in ./
forena.admin.inc - Form function for the edit report form
File
- ./
forena.admin.inc, line 571
Code
function forena_layout_form_validate($form, &$form_state) {
$values = $form_state['values'];
$regexp = "/^[A-Za-z0-9\\/\\_\\-]*\$/";
$save_report_name = $values['save_report_name'];
$report_name = $values['report_name'];
//checking illegal characters
if (!preg_match($regexp, $save_report_name)) {
form_set_error('save_report_name', t('Invalid character entered in Report Name'));
}
//comparing the report names to see if they have changed.
//If they have, making sure the new name does not already exist.
if ($report_name != $save_report_name) {
$report_path = forena_report_path();
$filename = $report_path . '/' . $save_report_name . '.frx';
if (file_exists($filename)) {
form_set_error('save_report_name', t('The file ' . $save_report_name . ' already exists. Please enter another name.'));
}
}
}