Well, not totally. I see this on the screen
{ "statusMsgs": "\x3cdiv class=\"messages status\"\x3eYour vote was registered.\x3c/div\x3e", "response": "\x3cdiv class=\"text\"\x3e\x3c!--paging_filter--\x3eWhen You Were Young (The Killers)\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 50%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e50% \x3cspan class=\"votes\"\x3e(2 votes)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"text\"\x3e\x3c!--paging_filter--\x3eMississippi Queen (Mountain)\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 25%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e25% \x3cspan class=\"votes\"\x3e(1 vote)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"text\"\x3e\x3c!--paging_filter--\x3e(Don\'t Fear) The Reaper (Blue Oyster Cult)\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 25%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e25% \x3cspan class=\"votes\"\x3e(1 vote)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"text\"\x3e\x3c!--paging_filter--\x3eMain Offender (The Hives)\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 25%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e25% \x3cspan class=\"votes\"\x3e(1 vote)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"text\"\x3e\x3c!--paging_filter--\x3eShe\'s a Badmammajamma (Carl Carlton)\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 25%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e25% \x3cspan class=\"votes\"\x3e(1 vote)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"total\"\x3eTotal votes: \x3cem\x3e4\x3c/em\x3e\x3c/div\x3e\x3cform action=\"/advpoll/cancel/67\" method=\"post\" id=\"advpoll-cancel-form\"\x3e\x3cdiv\x3e\x3cinput type=\"submit\" name=\"op\" id=\"edit-submit\" value=\"Cancel your vote\" class=\"form-submit\" /\x3e\x3cinput type=\"hidden\" name=\"form_token\" id=\"edit-advpoll-cancel-form-form-token\" value=\"3619cc7a21cb5099eabce5eb025ebd8a\" /\x3e\x3cinput type=\"hidden\" name=\"form_id\" id=\"edit-advpoll-cancel-form\" value=\"advpoll_cancel_form\" /\x3e\x3c/div\x3e\x3c/form\x3e" }I'm theming the block like this.
function oxm_advpoll_block_mostrecent() {
$node = advpoll_mostrecent();
$output = "<div class='poll_wrapper'>";
$output .= "<div class='poll_text'>";
$output .= "<h1 class='yellow_txt'>$node->teaser</h1>";
$output .= "<p class='white_txt'>$node->title</p>";
$output .= "<div class='poll_hr'></div>";
$output .= drupal_render($node->content);
$output .= "</div>";
$output .= "</div>";
return $output;
}
I think it's from doing using an image button in my form alter:
// oxm - poll button image
} elseif($form_id == 'advpoll_voting_binary_form') {
$img_src = base_path().path_to_theme()."/i/btn_vote.gif";
$img_ovr = base_path().path_to_theme()."/i/btn_vote_over.gif";
$form['vote']['#type'] = 'imagebutton_oxm';
$form['vote']['#image'] = $img_src;
$form['vote']['#attributes']['onmouseover'] = "this.src='$img_ovr';";
$form['vote']['#attributes']['onmouseout'] = "this.src='$img_src';";
$form['vote']['#attributes']['class'] = "poll_btn";
}
The info is submitted. If i reload the page after submission, i get the node view showing the results.
It would be best if I could just skip the node view altogether and have it just reload the current page.
Comments
Comment #1
anders.fajerson commentedThe block as well as the nodes uses JavaScript to submit the the poll. If I knew a way to do it I would suggest you turn off javascript for the block to submit it as usual, but I don't :)
I would suggest you find out the exact code in your custom theme that breaks the JavaScript and then try to work around it. Start with the default theme function and go from there.
Comment #2
emackn commentedDo I have to turn on something for the block to submit with ajax?
Comment #3
emackn commentedhmm.. this is weird. I turned off all theming for the block and i get the same issues.
Comment #4
emackn commentedI found that advpoll is trying to use ajax, but instead just printing out to the page with
Whats wrong?
Comment #5
emackn commentedAnother clue, I took a default drupal install and installed the module and it works correctly. So it must be something incompatible with my theme or a module. Not sure where to start?
Comment #6
anders.fajerson commentedAs I tried to say, start with the default setup and add you code incrementaly until something breaks. Then try to find the exact code that's causing the error. Basig bug hunting really, but unfortunately you are kind of your own on this as it's your own custom code.
Comment #7
emackn commentedNo, I heard what you were saying, just wanted to add those comments incase any of the symptoms were recognized. Thanks for the help.
Comment #8
anders.fajerson commentedYep, and it's nice to know that it's not the module that is broken :) Good luck!
Comment #9
emackn commentedOk.. i got it fixed. An older module I ported to drupal5 was writing javascript to the output buffer and that was causing all the problems.
Thanks for putting up with me ;)
Comment #10
emackn commentedI finally tracked down specifically what is causing the problem. The site I'm working on uses hitbox. And when ever I include that script, I get the ajax response spit out to the screen. Have you seen anything like this with hitbox javascript before?
Comment #11
emackn commentedAnother development, If i go in and add alert() calls to the advpoll-vote.js, clear the browser cache and reload, the ajax submission works. ??? what is going on?
Comment #12
ChrisKennedy commentedRemove the alerts, clear the browser cache, and see if it works.
Comment #13
emackn commentedThis is so weird. It doens't work, then I go in add a newline in the advpoll-vote.js script, save it, clear-cache, reload and it works in one browser, but from another machine it spits out the ajax response after taking the same steps.
if you want to see it in action: (don't want to post the dev url here)
AOL IM : twerent
Comment #14
emackn commentedAny other thoughts?
Comment #15
emackn commentedgrrr.. looks like im back to the hitbox javascript doing something to disrupt the ajax request.
Comment #16
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
hakcayurek commentedjust for the record, I have the same blank screen issue and I don't see why or how this is happening. I may update this thread if I find a solution.
Comment #18
anshuljain2k8 commentedGuys I also got same problem when used advanced poll , problem was i was using D-6 foy My Website and when i submitted poll it shows the JSON output or blank screen , when i debugged the code i found the function _advpoll_vote_response() which creates the output when you press submit . here after line
print drupal_to_js(array('statusMsgs' => '
', 'response' => $ajax_output));
exit();
There is and exit(); . just comment out this exit and your page will not go blank , and shows correct output.
As i am a Novice drupal developer so i am not confident about it so might be this was not actual solution but this worked for me, try this may be this will work for you guys too.
Best Luck Guys
: The AJ :)
Comment #19
rhylos commentedMy issue seems to have started randomly after adding the jgrowl module.
Comment #20
franfran commentedFor my case, I got the same issue due to the fact that jquery.form.js is loaded AFTER advpoll-vote.js.
If you turn on Javascript error console, you can see "ajaxform not found".
Since the js is not functional, when you submit the vote, the next page will show the blank page with the jason result...
Comment #21
rhylos commentedMakes sense. I had to turn off the poll module until this is sorted. Perhaps the ordering of the js will correct this.
Comment #22
vinoth.3v commentedI have same behavior on 6.x
Comment #23
vako commentedWow, after almost 7 years I have the exact issue. All I did was move the site from one host to another. The module was working with no issues with the previous host and this is the only issue with the new host.
Hope someone will shed a light on this weird error. i.e.: after every submit, we get the below error. I have followed the suggestions above and removed the "exit" code, but still no change.
Using D6 and disabled some modules with no change still. Since the issue started only when I changed the hosting company, I am assuming it has something to do with hosting software like versions of Apache or mySQL or PHP. Any suggestions?
"statusMsgs": "\x3cdiv class=\"messages status\"\x3eYour vote was registered.\x3c/div\x3e", "response": "\x3cdiv class=\"poll\"\x3e\x3cdiv class=\"text\"\x3eNo\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 50%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e50% \x3cspan class=\"votes\"\x3e(13 votes)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"text\"\x3eYes\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 42%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e42% \x3cspan class=\"votes\"\x3e(11 votes)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"text\"\x3eI don\'t know\x3c/div\x3e\x3cdiv class=\"bar\"\x3e\x3cdiv style=\"width: 7%;\" class=\"foreground\"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class=\"percent\"\x3e7% \x3cspan class=\"votes\"\x3e(2 votes)\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"total\"\x3eTotal votes: \x3cem\x3e26\x3c/em\x3e\x3c/div\x3e\x3c/div\x3e\x3cform action=\"/advpoll/cancel/3071\" accept-charset=\"UTF-8\" method=\"post\" id=\"advpoll-cancel-form\"\x3e\x3cdiv\x3e\x3cinput type=\"submit\" name=\"op\" id=\"edit-submit\" value=\"Cancel your vote\" class=\"form-submit\" /\x3e\x3cinput type=\"hidden\" name=\"form_build_id\" id=\"form-F4j-Rb8OCZkYLS9v_sB5F4LheiTw3BiBH0k2hB6q6U4\" value=\"form-F4j-Rb8OCZkYLS9v_sB5F4LheiTw3BiBH0k2hB6q6U4\" /\x3e\x3cinput type=\"hidden\" name=\"form_id\" id=\"edit-advpoll-cancel-form\" value=\"advpoll_cancel_form\" /\x3e\x3c/div\x3e\x3c/form\x3e" }Comment #24
organicwire commentedI confirm the bug in the current dev branch. So also D7 is affected.
When cancelling my votes, I am redirected to the path system/ajax and the JSON response is displayed.
- I am in the current poll with four options
- I submit two options
- I get the poll results displayed
- I click on Cancel your vote
- I get redirected to system/ajax, the JSON response is displayed
When going back and reload the poll page, my vote is indeed cancelled.
Exceptions:
- The redirect does not occur when I reload the poll page after submitting my choices. In this case cancelling my votes works fine.
- The redirect occurs only when cancelling votes with admin privileges.
Tested with Firefox 43.0.3 and Chromium 37.0.x.
Comment #25
organicwire commentedComment #26
tripper54 commentedInteresting!
I tried and failed to reproduce this locally.
It sounds to me like the cancel button triggers the form action rather than triggering an AJAX call.
* Are you able to reproduce this on a fresh install of drupal? If so, can you provide steps to reproduce?
* Are there any error messages in the JS console, before you press 'cancel', and when you press cancel?
* When you press 'cancel', do you see the standard AJAX throbber and 'please wait' message before the page reloads?
Comment #27
Christophe MolletHi,
I have exactly the same problem. To reproduce this error on a fresh install, you just have to download drupal common 7.x-3.33 and download and install the current version of advpoll (7.x-3.0-alpha1). After that, create an advpoll then submit and cancel 2 times and you will see the json below.
Please, don't hesitate to contact me if you want more informations.
Comment #28
Christophe Molletup !!!
Comment #29
Christophe Molletup again !!!