You are here

function avatar_selection_delete_form_validate in Avatar Selection 6

Same name and namespace in other branches
  1. 5.2 avatar_selection.module \avatar_selection_delete_form_validate()
  2. 5 avatar_selection.module \avatar_selection_delete_form_validate()
  3. 7 avatar_selection.admin.inc \avatar_selection_delete_form_validate()

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.

File

./avatar_selection.admin.inc, line 547
Administrative page callbacks for the avatar_selection module.

Code

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.'));
    }
  }
}