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

    How can I link form fields?

    Asked by DPoorman on September 14, 2013 at 08:38 PM

    I have a form that we use for teachers in a school to place their daily orders for their student's lunches.  Obviously time is a bit of a crunch, but we also need to get enough info from the teachers to know who they are and what lunch line their students are in.

     

    I have a form that we use as the "Order Form" with hidden fields at the bottom for extra information I want to be able to collect and use in the report and auto-mailer messages.  I then made a second form with these exact fields on it.  Can I simply fill the variables for each teacher into it (individually of course) and submit it and then call the data submitted from that form into the other forms hidden fields?

     

    Here is the order form with the hidden fields at the bottom: http://sfxorder.mpmnetworks.com/form/32568250322954

    Here is the secondary form that would have the info to go into the order forms fields: http://sfxorder.mpmnetworks.com/form/32568178512863

     

    Basically the teacher enters their "ID" on the Order Form, then it knows because the same "ID" is on the "Add New User" form who the user is and to take the rest of the data from the "New User" form and enter it to the matching hidden fields on the order form.

     

    I know simply plugging in the URL:

    http://sfxorder.mpmnetworks.com/form/32568250322954?firstName={firstName}&lastName={lastName}&gradeLevel32={gradeLevel}&roomNumber={roomNumber}

    wouldn't work unless the user just filled out the information form and I dropped that into the Thank You page, which I don't want to do.  I want the user info to be filled out once by myself and then always dropped into the "Order Form" form's hidden fields.  

     

    Would this by chance be possible using WebHooks?

     

    Hopefully this makes sense.  Thanks!

    link form order form order forms hidden variables
  • Profile Image

    Answered by jedcadorna on September 14, 2013 at 09:26 PM

    Hi,

    Thank you for contacting us, If I understood you correctly your second form which will add a new user will populate the field values to your order form hidden fields right? Prepopulating fields from one form to another is possible we have a step by step guide that will help you do that. Just let me know if the guide works. If I miss something just let me know and I will try to give the best resolution.

     

    Thanks,

  • Profile Image

    Answered by DPoorman on September 14, 2013 at 09:36 PM

    I've found that guide - the problem with that is the user would need to click on that link like I made above after filling out the information form.  I was trying to find a way to take information stored in a database from the "add new user" form and populate it into the hidden fields on the order form automatically.

     

    Basically, the user would go to the order form, enter their ID and fill out the rest of the form.  When it's submitted the ID entered by them on the order form would be matched to the ID in the database from the new user form and the hidden forms on the order form could be automatically populated.

  • Profile Image

    Answered by jedcadorna on September 14, 2013 at 10:13 PM

    Unfortunately that function is not available in Jotform form builder as of the moment. The work around you can do is to download the source code and you need to create your own database to capture data that is being submitted into your form and make some extensive PHP script that will validate the ID and pulls out the data from your MySQL database or whatever database you use.

  • Profile Image

    Answered by DPoorman on September 14, 2013 at 11:05 PM

    I figured that would be the case - but I did find a workaround, not really the best but it's just a form that then grabs and redirects to the URL I dictate in a php file based on the ID they enter.

     

    Which the url in the php form redirects them to the jotform link with the various parameters in the url for the hidden fields.

  • Profile Image

    Answered by jedcadorna on September 14, 2013 at 11:45 PM

    Hi, 

    Use POST method instead, its secure compare to GET, I just read your reply with the .php code of redirect.php. Try this instead you'll see the difference when value is being parsed. 

    <form action="redirect.php" method="post">
      <input name="mytext" />
      <input type="submit" />
    </form>

     

    <?
    switch($_POST['mytext'])
    {

        case 'USERNAMEHERE':

            header('Location: http://jotform.com/formid?variable={id}');

            break;

        default:

            print "<p>Invalid ID. Hit the back button and try again.</p>";
    break;

    }

    ?>

     

    Thanks,


  • Profile Image

    Answered by DPoorman on September 15, 2013 at 12:08 AM

    Thanks - made the change.  I guess "Get" came to mind faster than "Post."  Only issue I'm having now is my form is screwing up when it's embeded into the page.  It'll work just fine in a stand-alone window.  I redid the page twice to see if it fixed it and cleared my cache.

     

    Here's the test page it's on: http://sfx.mpmnetworks.com/d,home_site/p,en/test/t,order/

    Then here is the form by itself working perfectly.

  • Profile Image

    Answered by jedcadorna on September 15, 2013 at 12:33 AM

    Hi,

    Just replace the block of code from this sample screenshot into this:

     

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//support.jotform.com/form/32568250322954" frameborder="0" style="width:100%; height:969px; border:none;" scrolling="no"></iframe>

    <script type="text/javascript">window.handleIFrameMessage = function(e) {var args = e.data.split(":");var iframe = document.getElementById("JotFormIFrame");if (!iframe)return;switch (args[0]) {case "scrollIntoView":iframe.scrollIntoView();break;case "setHeight":iframe.style.height = args[1] + "px";break;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}</script>

     

    Let me know if this works.

    Thanks,