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

    Getting focus on a data field on google sites

    Asked by plantsguy on February 21, 2017 at 05:57 PM

    I need the first and only field to have focus on loading the website so I can utilize a barcode scanner without the user having to select the data field.  I have successfully embedded the Jotform https://form.jotform.com/70477876189172

    into https://sites.google.com/site/scanscaletickets/, and it is working but I cannot get the focus to work using the code I have found in this forum.... 

     

    Page URL:
    https://sites.google.com/site/scanscaletickets/

    Screenshot
  • Profile Image
    JotForm Support

    Answered by Chriistian on February 21, 2017 at 11:01 PM

    Hi,

    To be able get focus on the field when your form loads on the site, you need first to get the full source code of your form and embed to your site. After that, based from your form the field id is input_5. Please remove the # on #input_5.Can you please try this code below and see if this works?

    <script>

    document.observe("dom:loaded", function() {

      $('input_5).focus();

    });

    </script>

     

    And also, please make sure that your browser is allowed to load JavaScript codes.

    Hope this helps.

    Regards

     

  • Profile Image

    Answered by plantsguy on February 22, 2017 at 10:56 AM

    I appreciate the help, but I just cant seem to get it to work.  I have tried Google Chrome, IE11, and safari on my iphone.

     

    Javascript is enabled, and I copied the source code into the HTML box.  The form submits fine, but no focus.

    Has anyone ever done this on Google Sites (classic)?..the newest Google sites uses a Gadget, which doesn't seem to allow editing of the code

  • Profile Image
    JotForm Support

    Answered by david on February 22, 2017 at 01:46 PM

    It seems your filed ID in the embedded form is the following:

    input_5-caja-guest-0___

    Try using that instead of input_5 in your script.