You are here

function _advpoll_form_set_error in Advanced Poll 6.2

Same name and namespace in other branches
  1. 5 advpoll.module \_advpoll_form_set_error()
  2. 6.3 advpoll.module \_advpoll_form_set_error()
  3. 6 advpoll.module \_advpoll_form_set_error()

Wrapper function around form_set_error() to support validating of Ajax voting.

3 calls to _advpoll_form_set_error()
advpoll_voting_binary_form_validate in modes/binary.inc
Check if the submitted key exists, just to make sure the form is not bypassed.
advpoll_voting_ranking_form_validate in modes/ranking.inc
Implementation of the vote validation hook for the runoff module.
_advpoll_writeins_voting_form_validate in ./advpoll.module
Voting form validation logic specific to writeins. This has been abstracted away from includes in the modes directory.

File

./advpoll.module, line 1364
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function _advpoll_form_set_error($name = NULL, $message = '', $ajax = FALSE) {
  if ($ajax) {
    drupal_set_header('Content-Type: text/plain; charset=utf-8');
    print drupal_to_js(array(
      'errors' => '<div class="messages error">' . $message . '</div>',
    ));
    exit;
  }
  else {
    return form_set_error('choice[', $message);
  }
}