Long issue queue on this module!
I don't know what it will take to make advpoll compatible with jQuery 1.3.2, but this is the only feature holding me back from using this module.
When using jQuery_update 2.x (jquery 1.3.2) clicking "vote" results in no ajax update. Firebug does not give me a javascript error, it just does nothing. If I refresh the page, I see that my vote was recorded.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | advpoll_jquery13.patch | 889 bytes | jcmarco |
| #7 | advpoll_824496_7_pager.patch | 3.13 KB | miro_dietiker |
| #2 | advpoll-jquery_update-824496-2.patch | 1.15 KB | Vector- |
| #1 | advpoll-jquery_update-824496-1.patch | 1.55 KB | Vector- |
Comments
Comment #1
Vector- commentedI'd imagine this might be somewhat hard to reproduce... so here's a lil help with this one:
- As far as I can tell, this should only happen if you've got something else on a page loading a copy of jquery.form.js - which jQuery_Update 6.x-2.x-dev then replaces with the latest copy
- Minor changes in advpoll-vote.js get things working - it contains 'before' and 'after' options, which are no longer valid, replaced by 'beforeSubmit' and 'success'
I'd imagine there's a reason Advanced Poll includes its own copy of jquery.form.js - but so far things seem to work with the jQuery_Update version with this change....
Really though I'm somewhat curious about this... since Drupal core contains a copy of jquery.form.js... isn't including a custom one going to be prone to some rather weird intermittent bugs... that could be avoided?
Anyhow, if you're interested, give this a shot:
Make a copy of "advpoll-vote.js" called "advpoll-vote-updated.js" and then try the attached patch
The patch makes the mentioned changes to the options object to support the latest jquery.form.js (to the copy of advpoll-vote.js I mentioned, not to the original...), and if jQuery_Update is found, this updated file, along with 'misc/jquery.form.js' are loaded instead of the dated version included with Advanced Poll - jQuery_Update should subsequently replace jquery.form.js with its own version
I feel like there's probably a cleaner way to go about this, especially since the changes to the JS are very minor - perhaps someone a little more familiar with jQuery can chip in at some point...
Also... I'm relatively sure I didn't reproduce the exact conditions of your problem, as I have yet to experience this bug without tinkering with some AdvPoll code to force the condition (by making AdvPoll load 'misc/jquery.form.js' without the modifications to advpoll-vote.js) - which, as I said, I would imagine occurs when something else on a page loads jquery.form.js besides AdvPoll - so I'd be interested in knowing if it worked in your case - but this should be the root cause, I think?
Comment #2
Vector- commentedActually... I spent a bit more time looking into this, and the version of jquery.form.js that AdvPoll includes is dated 2006... which makes it even more outdated than the Drupal core version
I'm guessing this is because advpoll-vote.js relies on options which are incredibly deprecated ('before' and 'after' vs 'beforeSubmit' and 'success')
Seems to me... the appropriate solution for this is to update advpoll-vote.js, and try to load whatever version of jquery.form.js we get by default?
I think that would go something like this, and this works great running very recent jQuery versions - though I haven't tested it against a clean install!
I think it should since it looks like the Drupal core version of jquery.form.js is at least recent enough to use the 'beforeSubmit' and 'success' options, and jQuery_Update 6.x-2.x-dev includes the latest version of jquery.form.js
If this does work on a clean install... this is probably a better way of resolving this... since, well, seems kinda odd to include an extra dated copy of jquery.form.js rather than loading it from core...
Comment #3
vood002 commentedGreat catch, amazingly quick response! I applied the patch from #2 to a fresh 6.17 install and to my production install (running jquery_update 6.x 2.x.dev) and the ajax response works on both----thanks Vector!
Comment #4
roball commentedSo will this patch be committed? And I think the shipped "jquery.form.js" file should then be removed from the module.
Comment #5
kone23 commentedPatch in #2 worked for me as well.
Thank you Vector, you saved me a lot of hassle :)
Comment #6
Vector- commentedThis issue is a duplicate - a border case, specifically - as explained above
#479706: old version of jquery.form.js and extra .js files... why? contains a more complete description of the problem
As per that issue, there may be more things that need to be looked into regarding this...
Comment #7
miro_dietikerEDIT: removed. this patch was added to the wrong issue, sorry.
#215675: overhaul votes page code, cannot see all results, add pager query
Comment #8
miro_dietikerComment #9
miro_dietikerI can fully reproduce that with jquery_update_2.x_6.x the vote button will break (without this patch) on a clean install.
Also i'm pretty sure this is some obsolete remaining stuff from earlyer generations (<=D5) so removed the obsolete file jquery.form.js.
Committed to -dev
Comment #10
jcmarco commentedadvpoll is using deprecated selectors in advpoll-vote.js that break jquery 1.3.2 (jquery_update-6.x-2.x)
It was depreciated as of 1.2 and removed in 1.3. Change highlighted below.
jQuery 1.2.x:
$("a[@href*='admin/build/testing']").doSomething();
jQuery 1.2.6 and 1.3.x:
$("a[href*='admin/build/testing']").doSomething();
More detail at http://docs.jquery.com/Selectors/attributeHas#attribute
Comment #11
miro_dietikerYes.. you're fully right. I know this situation from many other modules. I wanted to check the @ selector too...
Directly applied the patch.