Hi,

Installed Ajax Poll module
Now, when I click on the "Vote" button I get the results all fine and dandy , but the title/question has dissapeared.
I can get it back with a page refresh, but still, not something that is desireable I would think.

Same thing happens again when clicked on the "Cancel Vote" button.

Comments

quicksketch’s picture

How is this poll being displayed? AJAX Poll uses different mechanisms depending on if you're looking at a block or at the node. Differences in your block or poll templating may also cause problems. Does this occur when viewing the site in Garland?

sunchaser’s picture

StatusFileSize
new49.89 KB

You are right. I should have been more descriptive, I'm sorry. still learning this issue - posting etiquette, it's a science on its own :)

I enabled the core Poll module
I then enabled the Ajax Poll

I created a poll with a taxonomy (cause I need different polls on different (category) pages)
I then created a Poll block-view that has the taxonomy Term as a Filter to show the latest poll in that specific category.

I then put the block in a region for it to be displayed on the right pages.

See attach for a graphical representation of what I'm on about
sorry about the mosaic filter in the screenshot, there is actually a reason for that...

quicksketch’s picture

Okay, sounds like a situation AJAX Poll doesn't yet accommodate for. Essentially this is a node displayed within a block, my guess is that AJAX Poll is using the block-behavior (replace the entire contents of the block) when it should use a node-like behavior (replace the contents of the node, but not the title). I'll have a look next time I'm working on AJAX Poll.

sunchaser’s picture

Sounds good.
thanx for your swift response.
Looking forward to your (or my own) solution for this.
Will post back here if I found a workaround... but I' wouldn't lose sleep over waiting for that to come from here ... I'm not the Ajax guru :d

Max_Headroom’s picture

StatusFileSize
new56.76 KB
new56.97 KB

I'm having exactly the same problem when I use the block on a Panels page.
Also using custom poll templates, but that is only to add more div classes for styling and to implement the suggestion on your readme.txt for showing the cancel vote button in a block.

This line is still in the templates:
<div class="title"><?php print $title ?></div>
and I got it wrapped in two other div classes.

First image shows firebug output as normal and second image is after I cancelled and revoted:
The print $title line as well as the two div classes that wraps it are missing.

Same happens for title on voting form.

using Panels 3.7
Hope this will help you find the problem.

Drave Robber’s picture

StatusFileSize
new1.95 KB

I have a very simple 'Random poll' block built with Views, and so far I have not experienced this problem – probably it only appears with certain Views settings. I have attached my exported view below – maybe you can work something out by comparing it with yours.

I'm having some other minor issues atm, but the titles are just fine. :)

mavimo’s picture

Assigned: Unassigned » mavimo
Status: Active » Reviewed & tested by the community

To solve this issue please change file ajax_poll.js on line 15 from:

var $pollWrapper = $form.parents('.content, .poll');

to

var $pollWrapper = $form.parent('.content, .poll');

see parents without S.

It work fine for me on node, blocks, views with node, ..

mavimo’s picture

StatusFileSize
new803 bytes

Patch attached

quicksketch’s picture

Could you try keeping parents() but use the ":first" modifier instead? Using parents() is more robust (less likely to break) when users override tpl.php files.

    var $pollWrapper = $form.parents('.content, .poll').first();
simon georges’s picture

I tried with the suggestion in #9 and AJAX broke totally, whereas with the suggestion in #7, it worked perfectly. I work on a site where a lot (and probably too much) customisation has been made on the theme part, so maybe that's why.
(I am using a bloc generated by a View with "Node" display type).

Anyway, thanks for the module, it is really great !

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Sorry my suggestion won't work in jQuery 1.2.3 (the Drupal 6 version of jQuery) because .first() doesn't exist in that version. .filter(':first') works much better:

    var $pollWrapper = $form.parents('.content, .poll').filter(':first');

This allows theming to add addition wrapper DIVs without breaking the AJAX functionality. I've committed this change and checked that it works as expected.

quicksketch’s picture

Title: Question dissapears on vote submit » Question disappears on vote submit or result not returned

Status: Fixed » Closed (fixed)

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

poukram’s picture

Status: Closed (fixed) » Active

Hello,

first, I would like to thank developers for this module, it is very help helpful.

But I have a problem with this bug, and this code :
var $pollWrapper = $form.parents('.content, .poll').filter(':first');

I use a block generated by view and a node teaser display, I have this structure :

<div class="block-inner">
<div class="block-heading">
<div class="content">
...
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first views-row-last">
<div id="node-64" class="node node node-mine node-teaser clearfix node-type-poll">
<div class="node-inner">
<div class="content">
<form id="poll-view-voting" class="ajax-poll ajax-vote ajax-poll-processed" method="post" accept-charset="UTF-8" action="/">
</form>
</div>
</div>
</div>
</div>
</div>
...
</div>
</div>
</div>

I have 2 div with the class "content" and when I submit the form the first

is used to be replace. I want to replace the nearest div from the form.

I think that the first suggestion is better :
var $pollWrapper = $form.parent('.content, .poll');

Can you reproduce the same bug ?
Thanks for everything.

alanpeart’s picture

Confirmed that patch in #8 works for me:
var $pollWrapper = $form.parent('.content, .poll');
The committed fix from #11 did not resolve my problem, which was the same as poukram's - a block generated by a view with a node teaser display.

cthshabel’s picture

Issue summary: View changes

Quicksketch thank you so much. Number 11 was the solution for Drupal 7 version of ajax_poll module. This helped me out a lot. Thanks again

arlingtonvoicellc’s picture

I also confirm #11 works for Drupal 7. Thanks!

UPDATE: Actually, #11 only works if you refresh the page one time. For some reason, when you visit the poll for the first time and click to vote, the button says "voting" and then turns back to "vote." Almost like a vote was never recorded. However, when you refresh the page, the results show. When you hit "cancel vote" the ajax works the way it should. So honestly, this module doesn't seem to function properly. If I have to refresh the page, then the purpose of the module is pointless. Wish it worked, was excited to use it.