I’ve made a subtle but potentially significant change to WordPress Google Form that I am looking for some people to try out. The plugin generates a jQuery script on the fly to perform a number of actions depending on the shortcode attributes present and their setting.
Historically the jQuery script has been output as part of the form code but I’ve seen a number of cases lately where another plugin or in some cases, the theme, is manipulating the page content which ends up affecting the jQuery script.
In one case I looked at this weekend something, I am still not sure what, is injecting paragraph elements into the HTML after it detects a closing DIV tag. For the most part this isn’t a big deal except, there are closing DIV tags in the jQuery script as part of the CAPTCHA functionality. The CAPTCHA functionality injects a DIV which holds a second DIV and some other input elements and labels. What ever is injecting the P elements into the HTML after every closing DIV is causing my script to have syntax errors when the page loads.
To solve this problem I have moved to loading of the jQuery script into the WordPress footer action. In my testing making this change has zero effect on the functionality but I’d like some other people to test it and provide me feedback.
Google Forms Beta (40528 downloads )
Thanks Mike. I wonder if this is not a theme issue. Do you want me share this with the theme dev – if he is intrested 🙂
You are more than welcome to share with the Theme Developer however I am not certain it is a theme issue. It could be a theme issue or it could be a plugin doing it as well. I’ve seen something like this before which is why I added code a while back to remove all of the line breaks and squash the jQuery script into a single line. That works for most cases but wouldn’t fix it if the DOM is being manipulated by jQuery which is what I think might be happening. I am hopeful that moving the jQuery script into the fooeter area will help prevent this scenario from even being an issue. Have you been able to try the beta version?
Thanks. I’ll try it now 😉 And let you know.
I should have asked you: How do I install the beta?
You have to do the manual plugin installation process. Download and unzip the file locally, then upload it to your server using FTP or similar process in place of v0.44 which you have installed.
I get the feeling I need to delete the previous version. As get a message from wordpress dashboard saying directory already exist. I’ll do the FTP way.
Hi Mike. Great suff clever man. All working. Have a look here http://capeholidays.info/houses-for-rent-simon-s-town-with-pool/
Yes, you will have to delete the old version before dropping in the new version. You can only have one version of the plugin installed at a time. Depending on your FTP client, you may be able to drop the wpgform folder on top of the old one and it will replace all of the existing files in place.
Awesome! Thanks for checking it out for me. I’ll probably roll out official v0.45 later tonight. Looking at the source of the page the jQuery script looks exactly as it should, no pollution, nothing unexpected. Moving it to the footer is definitely the right answer.
Cool dude. I hope you got the script that sends form results to your inbox on submit 😉
I have the script and the link and it is on my to-do list! Thanks.