Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

avatar_selection_delete_form_validate

Definition

avatar_selection_delete_form_validate($form, &$form_state)
contributions/avatar_selection/avatar_selection.module, line 915

Description

Validate the submission.

Check if Delete has been chosen AND a checkbox has been selected.

Parameters

$form General variable used in drupal, defining the structure & the fields of a form.

&$form_state General reference, used to control the processing of the form.

Code

<?php
function avatar_selection_delete_form_validate($form, &$form_state) {
  if ($form_state['values']['op'] == t('Delete')) {
    if (count(array_filter($form_state['values']['images'])) == 0) {
      form_set_error('images', t('Please select images to delete.'));
    }
  }
}
?>