function trigger_assign_form_validate

Form validation handler for trigger_assign_form().

Makes sure that the user is not re-assigning an action to an event.

See also

trigger_assign_form_submit()

1 string reference to 'trigger_assign_form_validate'
trigger_assign_form in modules/trigger/trigger.admin.inc
Returns the form for assigning an action to a trigger.

File

modules/trigger/trigger.admin.inc, line 212

Code

function trigger_assign_form_validate($form, $form_state) {
    $form_values = $form_state['values'];
    if (!empty($form_values['aid'])) {
        $aid = actions_function_lookup($form_values['aid']);
        $aid_exists = db_query("SELECT aid FROM {trigger_assignments} WHERE hook = :hook AND aid = :aid", array(
            ':hook' => $form_values['hook'],
            ':aid' => $aid,
        ))->fetchField();
        if ($aid_exists) {
            form_set_error($form_values['hook'], t('The action you chose is already assigned to that trigger.'));
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.