Closed mrclay closed 12 years ago
I'm not sure what the requirement is here. Currently when a person has voted on a poll, it displays the results. This is standard behaviour for the poll widgets I've seen. Are you asking for some other behaviour?
Switching to the results would be fine, but still show a Thank You message and remove the [Show poll] toggle.
That's what the code currently does for me using FF at least. A thank you message and no link. Are you seeing a show poll link even after a vote?
In FF9/OSX on your socnet site, voting simply unselects the selected option.
Wowsa. I can't reproduce that in FF, IE or Chrome under Win 7. The relevant JS is just this little snippet:
$('#poll-vote-button').live('click',function(e) {
e.preventDefault();
elgg.action('action/polls/vote', {data: $('#poll-vote-form').serialize(),
success : function(response) {
$('#poll-container').html(response.result);
}
});
});
As I don't have a Mac, I'll need a bit more information. If you vote on the poll view page, do you see the same non-behaviour that you see in the shoutout? Does your browser report any JS errors?
Also, could you try it in another browser, eg. Safari, to see if you see the same behaviour?
Is it possible that you were trying to vote when logged out? That was a bug I just fixed. Public polls are only public in the sense that non-logged-in-users can see the results. They now get a message inviting them to login rather than a vote button.
$.html() is getting called but is just silently failing. You might try removing the leading comment from the returned HTML snippet. If so, I'll report this as a jQuery bug :/
To be clearer, $('#poll-container').html(response.result);
is being called, but I think the leading HTML comment in response.result
is breaking jQuery.
In any case, the Vote button should be disabled immediately on clicking so multiple requests aren't sent.
(sorry for closing the issue, misclicked!)
OK, I have removed the comment and disabled the button after it is clicked. Please tell me if that fixes things for you.
Works for me (only for new polls, but that's fine).
It turned out that there was a bug when determining whether a person had already voted on a poll, which was really at the heart of the problem. I was passing an owner_guid option when doing the check (which worked for the creator of the poll), but it should have been annotation_owner_guid instead.
Replace the [Vote] button with "Thank you for voting!", leave the selected OPTION selected and set the
disabled
attribute on the others.