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

    Jotform Iframe getElementbyID

    Asked by morriswu on December 07, 2012 at 07:35 AM

    Hi guys, I'm trying to use javascript to prepoulate a value for a jotform form. I am using the iframe version of it, but when I run the code, I get the error, "Uncaught TypeError: Cannot call method 'getElementById' of undefined "

     Here's what my javascript look like, and what my iframe code looks like : 


        <script type='text/javascript'>

         $(window).load(function() {

               document.getElementById('jotform').document.getElementById('input_13').value = "<?=htmlspecialchars($_POST['input_13'], ENT_COMPAT)?>";




          <iframe  id="jotform" allowtransparency="true" src="//form.jotform.me/form/20988888993483" frameborder="0" style="width:100%; height:584px; border:none;" scrolling="no">
  • Profile Image
    JotForm Support

    Answered by NeilVicente on December 07, 2012 at 07:44 AM

    Prefill the form using URL parameters instead. For example:

    <iframe  id="jotform" allowtransparency="true" src="//form.jotform.me/form/20988888993483?numberOf=<?=htmlspecialchars($_POST['input_13'], ENT_COMPAT)?>" frameborder="0" style="width:100%; height:584px; border:none;" scrolling="no">

    numberOf is the input name of that particular text box. For more information on how to construct URL parameters for prepopulation, visit the following link: