summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/poll/poll.module3
-rw-r--r--modules/poll/poll.test5
2 files changed, 6 insertions, 2 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 4733fa238..c349829a2 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -720,7 +720,6 @@ function poll_view_voting($form, &$form_state, $node, $block = FALSE) {
'#type' => 'radios',
'#title' => t('Choices'),
'#title_display' => 'invisible',
- '#default_value' => -1,
'#options' => $list,
);
}
@@ -748,7 +747,7 @@ function poll_view_voting($form, &$form_state, $node, $block = FALSE) {
* Validation function for processing votes
*/
function poll_view_voting_validate($form, &$form_state) {
- if ($form_state['values']['choice'] == -1) {
+ if (empty($form_state['values']['choice'])) {
form_set_error( 'choice', t('Your vote could not be recorded because you did not select any of the choices.'));
}
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index 35eea2237..e24032d5a 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -315,6 +315,11 @@ class PollVoteTestCase extends PollTestCase {
$this->drupalLogin($vote_user);
+ // Record a vote without selecting any choice.
+ $edit = array();
+ $this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
+ $this->assertText(t('Your vote could not be recorded because you did not select any of the choices.'), 'Found the empty poll submission error message.');
+
// Record a vote for the first choice.
$edit = array(
'choice' => '1',