You are here

function abjs_test_form_save_validate in A/B Test JS 7

Validation function for new and edited tests.

1 string reference to 'abjs_test_form_save_validate'
abjs_test_form in ./abjs.admin.inc
Generates a form for adding and editing tests.

File

./abjs.admin.inc, line 429
Admin forms to view/add/edit/delete tests, conditions, experiences.

Code

function abjs_test_form_save_validate($form, &$form_state) {
  for ($i = 0; $i < count($form_state['values']['experiences_fieldset']) - 2; $i++) {
    if (!preg_match('#^[0-9./]+$#', $form_state['values']['experiences_fieldset'][$i]['experience_fraction'])) {
      form_set_error("experiences_fieldset][{$i}][experience_fraction", t('Invalid character used in Experience @i Fraction. Only numbers, decimals, and slashes are allowed. Other characters, including spaces, are not allowed.', array(
        '@i' => $i + 1,
      )));
    }
  }
}