Hi,
I have two forms on one of the pages on my site. Ajax doesn't work on the first form, but does on the second.
The page can be seen here: http://www.rocksoliddesigns.co.uk/about/contact-us/
Hi,
I have two forms on one of the pages on my site. Ajax doesn't work on the first form, but does on the second.
The page can be seen here: http://www.rocksoliddesigns.co.uk/about/contact-us/
Hi Olly,
Chrome is reporting a couple of javascript errors
Uncaught SyntaxError: Unexpected number http://www.rocksoliddesigns.co.uk/:250
Uncaught SyntaxError: Unexpected identifier http://www.rocksoliddesigns.co.uk/:376
Can you try testing for a theme/plugin conflict to narrow down the problematic script.
Regards,
Richard
It seems to be something in the theme, because there's no issue if I switch to twentyten.
The unexpected identifier was from the cookie control plugin, but i'm still getting the unexpected number with all the plugins disabled.
If it's something in the theme then the next step is to comment out the scripts included by the theme one at a time to try and narrow it down further.
I've done that now, as far as I can tell i've deactivated all the other scripts, i've deactivated all the plugins, including the mailchimp addon, so the only plugin running is gravity forms, and the form still won't use ajax.
Can you switch the theme again, I want to compare the Gravity Forms script beneath the form to see if it is being modified by the theme in anyway.
Done!
Thanks, you can switch it back, I will get back to you once I have gone through and compared the scripts.
OK found it, something in your theme, probably in the functions.php file is adding an unwanted space. This is an excerpt from the script beneath the form when using your theme
var is_form = !(form_content.length < = 0 || is_redirect);
and this is what it should be
var is_form = !(form_content.length <= 0 || is_redirect);
Can you try wrapping your form in [raw] [/raw] tags to see if that makes any difference.
Thanks, not sure what you mean by wrapping the form in [raw] tags though.
So if you edit that page I presume you have a form embed code, wrap the code in the raw tags so it looks something like this
[raw][gravityform id="1" name="ajax form" ajax="true"][/raw]
Ok, I thought that's what you meant, tried it, but the shortcodes just appear on the screen.
Sorry about the delay, could I get a look at your themes functions.php file, you can copy it to Pastie or PasteBin, the links are above the reply box.
functions.php is here:
and this file bones.php is included.
I can't see anything in those two files that could be adding the extra space, however it looks like the functions file does include a number of other files.
I've narrowed it down to the force_balance_tags in this:
add_filter('the_content', 'remove_empty_p', 20, 1);
function remove_empty_p($content){
$content = force_balance_tags($content);
return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}
I've stopped calling it as a filter, and i'm now using it where I need it directly, and it seems to have fixed the problem.
Thanks for all your help.
You're welcome, and I am glad you have figured it out.