What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Enabling Auto Fill causes SyntaxError in the source code of a form

    Asked by trackleaders on November 26, 2016 at 10:22 PM

    Hi,

    I'm using the direct source method of embed and am getting the following error in the console:

     

    Uncaught SyntaxError: Unexpected identifier

     

    Form is:

     

    https://www.jotform.com//?formID=62134286866968

     

    If someone could take a look I'd sure appreciate it.

     

    Thanks!

    Page URL:
    topofusion.com/purchase-form-sale.php

    source identifier direct
  • Profile Image
    JotForm Support

    Answered by jonathan on November 26, 2016 at 11:44 PM

    It is possible the current full source embedded code of your form https://www.jotformpro.com/form/62134286866968 have already a wrong text or typo error the reason it was failing.

    Can you also describe to us why you need to use the full source code embed of he form on your website?

    Having to alter and customize the full source codes of the form is susceptible to typing mistake and can easily break the form.

    Also when using full source code, every time you modify the form in the Form Builder, you will be required to get again the full source and redo all the embed process on your website.

    If not necessary to use the full source code, we recommend just using the default embed code.

    If the syntax error is on the full source code of the form, the only way to fix it is to get a new/fresh code again in the Form Builder.

    Hope this help. Let us know if issue persist.

  • Profile Image

    Answered by Scott  on November 27, 2016 at 01:43 AM

     

    Hi,

     

    Thanks for the reply.

     

    I need to use the full source so I can compute registration codes.  I am just copying and pasting the full source, which used to work (and still does if I revert to the old code).  I made a small change to the form, then grabbed new code, and now get this error.

     

    Is it possible there is a bug in the code generation?  If you could try pasting the full source into a page, perhaps it would show the issue.

    I also wonder if it might have to do with the very long line of code in it. Perhaps something is happening when I paste that?

     

    Thanks very much for the quick replies!

     

     

    Scott

     

     

  • Profile Image
    JotForm Support

    Answered by Boris on November 27, 2016 at 05:14 AM

    Hi Scott,

    Please insert a semicolon before the JotForm.onSubmissionError="jumpToFirstError" line, so that your code turns from this:

    <script type="text/javascript"> JotForm.init(function(){ JotForm.description('input_6', 'Emails are sent ONLY for new versions. We don\'t share emails with ANYONE.'); productID = {"0":"input_5_1001","1":"input_5_1002"}; paymentType = "product"; JotForm.setCurrencyFormat('USD',true, 'point'); JotForm.totalCounter({"input_5_1001":{"price":"69.95"},"input_5_1002":{"price":"40"}}); JotForm.alterTexts(undefined, true); JotForm.clearFieldOnHide="disable"; setTimeout(function() { JotForm.autoFillInitialize({"bindChange":"on","menu":"enable","timeout":"4","ttl":"86400"}); }, 10) JotForm.onSubmissionError="jumpToFirstError"; });
    </script>

    Into this:

    <script type="text/javascript"> JotForm.init(function(){ JotForm.description('input_6', 'Emails are sent ONLY for new versions. We don\'t share emails with ANYONE.'); productID = {"0":"input_5_1001","1":"input_5_1002"}; paymentType = "product"; JotForm.setCurrencyFormat('USD',true, 'point'); JotForm.totalCounter({"input_5_1001":{"price":"69.95"},"input_5_1002":{"price":"40"}}); JotForm.alterTexts(undefined, true); JotForm.clearFieldOnHide="disable"; setTimeout(function() { JotForm.autoFillInitialize({"bindChange":"on","menu":"enable","timeout":"4","ttl":"86400"}); }, 10); JotForm.onSubmissionError="jumpToFirstError"; });
    </script>

    This should resolve the Syntax Error you were getting.

    I have also checked this issue over several different forms, and I noticed the Syntax Error occurs when enabling the Auto Fill option - the code for the Auto Fill does not have a semicolon at the end of its statement.

    Thank you for bringing it to our attention, I have escalated this to our developers as a bug report. We will let you know through this support thread once the issue is resolved, but you can also fix it yourself in your code by simply inserting a semicolon as described above.

    Please let us know how it goes.

  • Profile Image

    Answered by trackleaders on November 27, 2016 at 03:42 PM

     

    Excellent, that took care of the issue.  Thanks for the quick diagnosis and the resolution -- glad I could help debug a tiny part of this great service you provide.

     

    Thanks!