You are here

function node_gallery_change_gallery_action_validate in Node Gallery 6.3

Validates the change gallery form.

_state

Parameters

$form:

1 string reference to 'node_gallery_change_gallery_action_validate'
node_gallery_form_alter in ./node_gallery.module
Implements hook_form_alter().

File

./node_gallery.actions.inc, line 253
Contains all actions for node gallery.

Code

function node_gallery_change_gallery_action_validate($form, $form_state) {
  $gid = $form_state['values']['gid'];
  if (!is_numeric($gid) && $gid != 'new_gallery') {
    form_set_error('gid', t('Please select a value.'));
  }
  if (is_numeric($gid)) {
    $count = db_result(db_query("SELECT COUNT(*) FROM {node_gallery_galleries} WHERE gid = '%d'", $gid));
    if (intval($count) != 1) {
      form_set_error('gid', t('Please enter a valid gallery.'));
    }
  }
}