Commit 0c8dc6ea authored by David_Rothstein's avatar David_Rothstein

Issue #1823906 by joshi.rohit100, amitgoyal, rahulbile | gargsuchi: Fixed...

Issue #1823906 by joshi.rohit100, amitgoyal, rahulbile | gargsuchi: Fixed Incorrect error message when poll is submitted with no option selected.
parent 010a9a54
......@@ -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.'));
}
}
......
......@@ -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',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment