PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Expected ')' bug with Gravity forms 1.7.5 ajax form

  1. interactive_bytes
    Member

    I am getting an error with the below code, when using a form with ajax. I am using version 1.7.5

    jQuery('#gform_wrapper_1').replaceWith('<' + 'div id='gforms_confirmation_message' class='gform_confirmation_message_1'' + '>' + confirmation_content + '<' + '/div' + '>');

    The error says Expected ')'.

    I assume it's because the forward slashes aren't escaped properly?

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  2. Richard Vav
    Administrator

    Hi,

    It's not the escaping of the slashes, I suspect it is to do with the use of the single and double quotes, also you should be able to simplify it down to the following

    jQuery('#gform_wrapper_1').replaceWith('<div id="gforms_confirmation_message" class="gform_confirmation_message_1">' + confirmation_content + '</div>');

    Regards,
    Richard

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  3. interactive_bytes
    Member

    Thanks Richard, but this is the default code generated from GF. I should have probably submitted a priority support ticket.

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  4. Richard Vav
    Administrator

    Sorry, you're correct I should have spotted that, here's what it looks like on my GF 1.7.5, WP 3.5.1 and twenty twelve theme localhost setup

    jQuery('#gform_wrapper_1').replaceWith('<' + 'div id=\'gforms_confirmation_message\' class=\'gform_confirmation_message_1\'' + '>' + confirmation_content + '<' + '/div' + '>');

    something on your setup is messing with the script and stripping the backslashes, have you tried testing for a plugin/theme conflict.

    Regards,
    Richard

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  5. interactive_bytes
    Member

    Thanks Richard.

    I should never code/debug when tired. I was globally applying a stripslashes to custom fields.

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  6. Richard Vav
    Administrator

    No problem, glad you figured it out.

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink

This topic has been resolved and has been closed to new replies.