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.

Unexpected token ILLEGAL

  1. I am unable to add any fields to new forms, or save forms. When I attempt to add a new field to the form, nothing happens.

    Opening the Chrome inspector, I see on the console "Uncaught SyntaxError: Unexpected token ILLEGAL" in tw-sack.min.js

    Can you shed some light on what the possible causes for this error are? I'm using the most recent version of Gravity Forms (1.6.11) on WordPress 3.5. I've disabled all other plugins as a troubleshooting attempt.

    Thanks

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  2. FYI I tested the same in FireFox and got an "illegal character" error in the console.

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  3. Used Firebug with WordPress script debugging enabled so it wouldn't use the minified version.

    Error happening here:

    illegal character
    this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    Line 43 of tw-sack

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  4. Ryan, can you share the link to the page where your form is embedded so we can see this for ourselves? Or does this only occur in the form builder?

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  5. humaan
    Member

    Unfortunately we have a similar issue. The only difference we are aware of between when it was working and now is that Wordpress was upgraded to version 3.5 using the auto update feature.

    The issue (for us anyway) is that appears to only affect the form builder. If I click a button to add a field the following error message is shown in the Chrome developer tool console and nothing happens on the page:

    Uncaught SyntaxError: Unexpected identifier (tw-sack.min.js:1)
    runResponse (tw-sack.min.js:1)
    xmlhttp.onreadystatechange (tw-sack.min.js:1)

    The actual form on the web page works fine.
    Let me know if you need more info?

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  6. humaan
    Member

    Forgot to mention that we tried the Twenty Ten theme and then deactivating all the plugins but the issue still remains (from http://www.gravityhelp.com/documentation/page/Testing_for_a_Theme/Plugin_Conflict).
    Cheers.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  7. humaan
    Member

    We found out what was causing the issue.
    We had the following function in a plugin file:

    add_filter( 'gform_field_content', 'my_custom_field', 10, 5 );
    function my_custom_field( $content, $field, $value, $lead_id, $form_id ) {
    	$content .= '<div class="clear"></div>';
    	return $content;
    }

    Commenting out this function fixed the issue. Not sure why but it works now. (Also, when we tested I'm guessing something was cached which is why we didn't notice a change which you've pointed out in your testing instructions).
    Cheers.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  8. Thank you for that update. What function was that code providing for you? I see the div is clearing something, but where did you need that?

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink