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

anders.fajerson’s picture

The 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.

emackn’s picture

Do I have to turn on something for the block to submit with ajax?

emackn’s picture

hmm.. this is weird. I turned off all theming for the block and i get the same issues.

emackn’s picture

I found that advpoll is trying to use ajax, but instead just printing out to the page with

function _advpoll_vote_response($node, $form_values) {
  $msg = t('Your vote was registered.');
  // Ajax response
  print_r($form_values);
  if ($form_values['ajax']) {
    list($node->voted, $node->cancel_vote) = _advpoll_user_voted($node);
    $ajax_output .= advpoll_view_results($node, NULL, NULL);
    // Remove linebreaks as they will break jQuery's insert-HTML methods
    $ajax_output = str_replace("\n", '', $ajax_output);
    drupal_set_header('Content-Type: text/plain; charset=utf-8');
    //### THIS IS PRINTING TO THE SCREEN
    print drupal_to_js(array('statusMsgs' => '<div class="messages status">'. $msg .'</div>', 'response' => $ajax_output));
    exit();
  }
  // Usual response
  else {
    drupal_set_message($msg);
  }
}

Whats wrong?

emackn’s picture

Another 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?

anders.fajerson’s picture

Status: Active » Fixed

As 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.

emackn’s picture

No, I heard what you were saying, just wanted to add those comments incase any of the symptoms were recognized. Thanks for the help.

anders.fajerson’s picture

Yep, and it's nice to know that it's not the module that is broken :) Good luck!

emackn’s picture

Ok.. 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 ;)

emackn’s picture

I 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?

emackn’s picture

Another 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?

ChrisKennedy’s picture

Remove the alerts, clear the browser cache, and see if it works.

emackn’s picture

This 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

emackn’s picture

Any other thoughts?

emackn’s picture

grrr.. looks like im back to the hitbox javascript doing something to disrupt the ajax request.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

hakcayurek’s picture

just 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.

anshuljain2k8’s picture

Version: 5.x-1.0-beta5 » 6.x-1.x-dev
Status: Closed (fixed) » Active

Guys 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' => '

'. $msg .'

', '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 :)

rhylos’s picture

Version: 6.x-1.x-dev » 5.x-1.0-beta6

My issue seems to have started randomly after adding the jgrowl module.

franfran’s picture

For 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...

rhylos’s picture

Makes sense. I had to turn off the poll module until this is sorted. Perhaps the ordering of the js will correct this.

vinoth.3v’s picture

Version: 5.x-1.0-beta6 » 6.x-1.x-dev

I have same behavior on 6.x

vako’s picture

Wow, 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" }

organicwire’s picture

Title: Blank screen after block submission » JSON source and redirect to AJAX path after submission
Version: 6.x-1.x-dev » 7.x-3.0-alpha1
Category: Support request » Bug report

I 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.

organicwire’s picture

Title: JSON source and redirect to AJAX path after submission » After cancelling vote: redirect to AJAX path and displaying JSON source
tripper54’s picture

Status: Active » Postponed (maintainer needs more info)

Interesting!

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?

Christophe Mollet’s picture

Hi,

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.

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"commons_origins","theme_token":"Srqhs819al1M5_6HdXgnGKHLR3CIn7C6ePzl15tyVyM","jquery_version":"1.7"},"timeago":{"refreshMillis":60000,"allowFuture":true,"localeTitle":false,"cutoff":0,"strings":{"prefixAgo":null,"prefixFromNow":null,"suffixAgo":"ago","suffixFromNow":"from now","seconds":"less than a minute","minute":"about a minute","minutes":"%d minutes","hour":"about an hour","hours":"about %d hours","day":"a day","days":"%d days","month":"about a month","months":"%d months","year":"about a year","years":"%d years","wordSeparator":" "}},"custom_search":{"form_target":"_self","solr":0},"ajax":{"edit-submit-advpoll-7":{"callback":"advpoll_form_submit","wrapper":"advpoll-form-7","name":"submit1","event":"mousedown","keypress":true,"prevent":"click","url":"\/system\/ajax","submit":{"_triggering_element_name":"op","_triggering_element_value":"Vote"}}},"urlIsAjaxTrusted":{"\/system\/ajax":[true,true]}},"merge":true},{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"commons_origins","theme_token":"Srqhs819al1M5_6HdXgnGKHLR3CIn7C6ePzl15tyVyM","jquery_version":"1.7"},"timeago":{"refreshMillis":60000,"allowFuture":true,"localeTitle":false,"cutoff":0,"strings":{"prefixAgo":null,"prefixFromNow":null,"suffixAgo":"ago","suffixFromNow":"from now","seconds":"less than a minute","minute":"about a minute","minutes":"%d minutes","hour":"about an hour","hours":"about %d hours","day":"a day","days":"%d days","month":"about a month","months":"%d months","year":"about a year","years":"%d years","wordSeparator":" "}},"custom_search":{"form_target":"_self","solr":0},"ajax":{"edit-submit-advpoll-7":{"callback":"advpoll_form_submit","wrapper":"advpoll-form-7","name":"submit1","event":"mousedown","keypress":true,"prevent":"click","url":"\/system\/ajax","submit":{"_triggering_element_name":"op","_triggering_element_value":"Vote"}}},"urlIsAjaxTrusted":{"\/system\/ajax":true}},"merge":true},{"command":"insert","method":null,"selector":null,"data":"\u003Cform action=\u0022\/system\/ajax\u0022 method=\u0022post\u0022 id=\u0022advpoll-form-7\u0022 accept-charset=\u0022UTF-8\u0022 class=\u0022form\u0022\u003E\n \u003Cdiv\u003E\n \n \u003Cdiv class=\u0022form-item form-type-radios form-item-choice-2\u0022\u003E\n \u003Cdiv id=\u0022edit-choice-2\u0022 class=\u0022form-radios\u0022\u003E\u003Cdiv class=\u0022form-item form-type-radio form-item-choice-2\u0022\u003E\n \u003Cinput type=\u0022radio\u0022 id=\u0022edit-choice-2-cf96fe204\u0022 name=\u0022choice_2\u0022 value=\u0022cf96fe204\u0022 class=\u0022form-radio\u0022 \/\u003E \u003Clabel class=\u0022option\u0022 for=\u0022edit-choice-2-cf96fe204\u0022\u003Etest1 \u003C\/label\u003E\n\n\u003C\/div\u003E\n\u003Cdiv class=\u0022form-item form-type-radio form-item-choice-2\u0022\u003E\n \u003Cinput type=\u0022radio\u0022 id=\u0022edit-choice-2-fb4afde94\u0022 name=\u0022choice_2\u0022 value=\u0022fb4afde94\u0022 class=\u0022form-radio\u0022 \/\u003E \u003Clabel class=\u0022option\u0022 for=\u0022edit-choice-2-fb4afde94\u0022\u003Etest2 \u003C\/label\u003E\n\n\u003C\/div\u003E\n\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cinput type=\u0022submit\u0022 id=\u0022edit-submit-advpoll-7\u0022 name=\u0022op\u0022 value=\u0022Vote\u0022 class=\u0022form-submit\u0022 \/\u003E\u003Cinput type=\u0022hidden\u0022 name=\u0022form_build_id\u0022 value=\u0022form-hqDBZQ-UZlJvDFqfXS7plUphqbUdGC-AUX4LhcwBNoU\u0022 \/\u003E\n\u003Cinput type=\u0022hidden\u0022 name=\u0022form_token\u0022 value=\u0022Y-AKYtw5NRYK7miW7iR4WkJAkCN2uuADmXq5rTF76kI\u0022 \/\u003E\n\u003Cinput type=\u0022hidden\u0022 name=\u0022form_id\u0022 value=\u0022advpoll_choice_form\u0022 \/\u003E\n\n \u003C\/div\u003E\n\u003C\/form\u003E\n\n","settings":null},{"command":"insert","method":"prepend","selector":null,"data":"","settings":null}]

Christophe Mollet’s picture

up !!!

Christophe Mollet’s picture

up again !!!