poll_more_choices_submit

Versions
6 – 7
poll_more_choices_submit($form, &$form_state)

Submit handler to add more choices to a poll form. This handler is used when javascript is not available. It makes changes to the form state and the entire form is rebuilt during the page reload.

Code

modules/poll/poll.module, line 330

<?php
function poll_more_choices_submit($form, &$form_state) {
  include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'node') . '/node.pages.inc';
  // Set the form to rebuild and run submit handlers.
  node_form_submit_build_node($form, $form_state);

  // Make the changes we want to the form state.
  if ($form_state['values']['poll_more']) {
    $n = $_GET['q'] == 'system/ajax' ? 1 : 5;
    $form_state['choice_count'] = count($form_state['values']['choice']) + $n;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.