Does redirect work with shortcode?
-
Redirect not working in Ajax or redirect mode on a shortcode embedded form. Should it?
-
Yes it should but in your case it doesn’t because you have Javascript errors on your page which prevent the redirect from ever firing.
Your error is somewhere in here:
ga('send', 'pageview'); $(document).ready(function() { $("form#ss-form").each(function() { var jqForm = $(this); var jsForm = this;To safely use Javascript’s “$” shortcut within WordPress, you need to do something like this so jQuery will run in “no conflict” mode:
// Google Forms v0.76 jQuery script jQuery(document).ready(function($) {There is some more information in the WordPress Codex.
I didn’t need that code anyway. Removed. Redirects are still not working.
I see the following in the source code after page submission, but the page never redirects.
"// Confirmation page by redirect window.location.replace("http://buildittogether.newmindgroup.com/registration-confirmation/") "Can you try something for me? Temporarily turn off validation on the form and see if the redirect works then. I suspect it will. I am reading something and it appears that the jQuery Validation library has a minor change in it that I haven’t accounted for.
Mike,
Yup, that worked. Turning off validation allowed the redirect to take place.
So what are next steps?
Not sure. I did some comparisons with a form on my site and the exact same syntax works on my site which fails on your site. I need to do some more testing.
Can you fill out my Help and Support Form? I’d be curious to see if there is something different about your form and the one I test with. It looks like you did some regular expression validation – what is your RegExp?
The only REGEXP would be what Google bakes in for url validation. The 2 fields (linkedin and Google+) are the only 2 with url validation and neither are required.
There is still something odd going on. When I look at your page now it still generates a Javascript error:
TypeError: $(...).columnize is not a function $(".wpgform-wrapper").columnize({This shouldn’t be happening. In looking at the page source, the Javascript library which Google Forms loads as part of the wp_footer action isn’t loaded. It looks like either (a) your theme isn’t calling wp_footer() or (b) some other plugin is mucking with the wp_footer action so the Google Forms hook never gets called.
The net result in the Javascript library never being loaded which is why I am seeing the jQuery error. If you enable validation again it is the exact same problem just earlier in the jQuery script as the jQuery Validate library is loaded from the same hook as the Columnizer library is.What other plugins do you have loaded?
I don’t see the error on the page any longer, did you find the source of the Javascript error?
The topic ‘Does redirect work with shortcode?’ is closed to new replies.