You are here

function weather_es_configuration_form_validate in Weather_es 6.2

Validate the form.

File

./weather_es.module, line 255
Shows weather data of Spain (by AEMET)

Code

function weather_es_configuration_form_validate($form, &$form_state) {
  switch ($form_state['values']['step']) {
    case 1:
      if ($form_state['values']['provincia']['seleccionada'] == 0) {
        form_set_error('seleccionada', t('You must select a valid province.'));
      }
      else {
        $form_state['rebuild'] = TRUE;

        // Changes between Drupal-6.x-1.3 and Drupal-6.x-1.4. See http://drupal.org/node/302240
        $form_state['submitted'] = TRUE;
      }
      break;
    case 2:
      if (strlen($form_state['values']['poblacion']['seleccionada']) != 5 or !in_array($form_state['values']['idioma'], array(
        'es',
        'ca',
        'gl',
        'eu',
        'en',
        'fr',
      ))) {
        form_set_error('seleccionada', t('You must select a valid city and a valid language.'));
      }
      else {
        $form_state['rebuild'] = FALSE;
      }
      break;
    default:
      $form_state['rebuild'] = FALSE;
  }
}