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

    If/then populate fields

    Asked by dleflang on January 17, 2012 at 05:03 AM

    Hello,

    is it possible to dynamically populate fields?

    if a field answer is 2, then the following 5 fields are automatically default value as 2.

    if a field answer is 3, then the following 5 fields are automatcially default value of 3.

     

    Thank you

    Dave

  • Profile Image

    Answered by fxr on January 17, 2012 at 11:10 AM

    Hello Dave,

    No, its not possible to dynamically populate fields in that manner (at least, not without uploading the form source code to a server and using a little javascript.)

    It may, however, be possible to mimic that functionality, but it would mean you have a finite number of options for the 'answer' in the original field. is that the case? e.g 1,2,3,4 or 5 ? NOTE: this potential solution involves creating a significant amount of conditions. 

     

    If this functionality is something you'd really like to do, we could also help you explore the javascript option mentioned in the first paragraph. 

  • Profile Image

    Answered by dleflang on January 17, 2012 at 12:20 PM
    Yes, Id very much like some hints/tips regarding the Javascript you mentioned in the first paragraph.
    Thank you
    Dave

  • Profile Image

    Answered by fxr on January 17, 2012 at 12:46 PM

    OK, we should be able to provide you with javascript required to add the functionality you are looking for. The way you have described your requirements, it should involve relatively simple code. 

    But to add javascript to your form, you need to upload its source code to your webserver. 

    This post describes how to download your forms source.

    That will download a zip archive , you need to then extract those files and upload them to your webserver. 

    When that is done, get back in touch with the URL, explaining exactly what fields need populated with the data from another, and we will endeavour to provide you with the neccesary javascript and tell you where you need to add it. 

    NOTE: when uploading form source code to your webserver, if you make any new edits to your form, you will have to reupload the source HTML file again. All other form functionality will be just the same. 

     

    Please let us know if you have any questions on that.

  • Profile Image

    Answered by dleflang on January 19, 2012 at 05:33 AM
    Hello,
    Here is the URL:
    https://dataramp.com/jotformurl.html

    The goal is to get all fields to populate to match user selection of the first field.
    If user chooses to edit 1 or more fields, they can.
    Example, user selects “normal” in the first field.
    Then, all subsequent fields become “normal”

    Could you please suggest the code for this?

    Thank you
    Dave

  • Profile Image

    Answered by fxr on January 19, 2012 at 05:47 AM

    Got it.

    Yeah, I should be able to provide javascript to do that. 

    I will get back to you later today with a script you can add. 

    Just one thing i need to confirm: its only the first question i.e 'Basal anteroseptum' that sets the values in each of other fields? 


  • Profile Image

    Answered by dleflang on January 19, 2012 at 11:09 AM
    Correct
    Sent from my iPhone
  • Profile Image

    Answered by fxr on January 19, 2012 at 06:48 PM

    Here is the script you need to add that functionality to your form:

    http://pastie.org/pastes/3216291/text

    Put it in just before the closing </body> tag. 

    I also recommend adding proper headers to your HTML file; IE can act strange without them. 

    The important ones are first two lines at the top of my copy of your forms source here

    Working form as per your spec is here

    --

    You should be able to just copy my entire webpage source and put it a page on your server. 

    You could also iframe that webpage to embed it onto one of your existing webpages. 

     

    Please let me know if you have any further questions. 

     

  • Profile Image

    Answered by dleflang on January 20, 2012 at 01:54 AM
    You got it!
    Now, to get the dev team to make this work on our form……
    Thanks!

  • Profile Image

    Answered by fxr on January 20, 2012 at 05:00 AM

    I have tried to make the code as reusable as possible. It shouldnt be too diifficult to adapt and use on other forms. 

    Hopefully your dev team have some success with it. Let us know if you think we can help with anything else.