You are here

function ife_settings_form_validate in Inline Form Errors 6.2

Same name and namespace in other branches
  1. 6 ife.settings.inc \ife_settings_form_validate()
  2. 7.2 ife.settings.inc \ife_settings_form_validate()
  3. 7 ife.settings.inc \ife_settings_form_validate()

IFE settings form validations

File

./ife.settings.inc, line 113
Admin settings pages

Code

function ife_settings_form_validate($form, &$form_state) {
  $values = $form_state['values'];

  //check if form_id already exists
  $new_form_id = $values['form_ids']['new_form_id']['form_id'];
  if ($new_form_id && form_id_load($new_form_id)) {
    form_set_error('form_ids][new_form_id][form_id', t('The form %form_id has already been added.', array(
      '%form_id' => $new_form_id,
    )));
  }

  //check if the form_id is valid
  if (!preg_match('/^[a-z0-9_]*$/', $new_form_id)) {
    form_set_error('form_ids][new_form_id][form_id', t('The form_id %form_id is invalid.', array(
      '%form_id' => $new_form_id,
    )));
  }
}