You are here

function mostpopular_services_form_validate in Drupal Most Popular 6

File

./mostpopular.admin.inc, line 415
Defines all the administration forms for the Most Popular module.

Code

function mostpopular_services_form_validate($form, $form_state) {
  if ($form_state['values']['op'] != $form_state['values']['reset']) {

    // Validate the services
    $services = $form_state['values']['services'];
    foreach ($services as $i => $service) {
      $title = $service['title'];
      $enabled = $service['enabled'];
      if ($enabled && empty($title)) {
        form_set_error("services][{$i}][title", t('You must choose a title to be displayed this service.'));
      }
    }
  }
}