You are here

function viewport_settings_form_validate in Viewport 7

Validates the values entered for the viewport properties.

At the time being, it only provides a basic validation, looking for the existence of commas.

File

./viewport.admin.inc, line 87
Admin interfaces for viewport module.

Code

function viewport_settings_form_validate(&$form, &$form_state) {
  foreach ($form_state['values'] as $key => $value) {

    // User_scalable is a checkbox, no need to check for commas.
    if (strstr($key, 'viewport_') && $key != 'viewport_user_scalable') {
      if (strstr($value, ',')) {
        form_set_error($key, t('Commas are not allowed for the %field_name field.
        Please, ensure you are using dots (".") when entering decimal values,
        and avoid any commas after the values', array(
          '%field_name' => $form['viewport'][$key]['#title'],
        )));
      }
    }
  }
}