You are here

function msnf_validate_css_class in Multistep Nodeform 7

Validate the entered css class from the submitted format settings.

Parameters

array $element: The validated element.

array $form_state: The current state of the form.

1 string reference to 'msnf_validate_css_class'
msnf_msnf_format_settings in ./msnf.module
Implements hook_msnf_format_settings(). If the step has no format settings, default ones will be added.

File

includes/msnf.field_ui.inc, line 662
msnf.field_ui.inc is a file that contains most functions needed on the Fields UI Manage forms (display and fields).

Code

function msnf_validate_css_class($element, &$form_state) {
  if (!empty($form_state['values']['fields'][$form_state['formatter_settings_edit']]['format_settings']['settings']['instance_settings']['classes']) && !preg_match('!^[A-Za-z0-9-_ ]+$!', $form_state['values']['fields'][$form_state['formatter_settings_edit']]['format_settings']['settings']['instance_settings']['classes'])) {
    form_error($element, t('The css class must include only letters, numbers, underscores and dashes.'));
  }
}