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

    Is there a way to use an API script to build dropdown options?

    Asked by Alan  on January 14, 2015 at 02:49 PM

    What I am trying to do is the following:

    I have a new API for a database I am using that goes into the database and will look for the names associated with a specific account.  I am trying to find out if in JotForm I can use that API to populate a dropdown.

    For Example:

    I am Account X in the database and Person1, Person2, Person3, & Person4 are part of my Account X.  I want to ask in the dropdown which Person helped the customer.  The reason I need to pull from the database is because frequently I might need to Add or Delete Persons.

    The link I am trying to get this from is using the HTTP Get method.

    Thanks!

    dropdown options jotform api populate dropdown
  • Profile Image
    JotForm Support

    Answered by Mike on January 14, 2015 at 05:04 PM

    Thank you for contacting us.

    We provide a form source code embedding method, so the form code can be modified. Our dropdown looks like this:

    So basically you can generate the 'options' with your custom script to populate the dropdown. For example, there is a thread in Stackoverflow about populating with PHP:

    How to populate HTML dropdown list with values from database

    Another approach might be changing the form dropdown options via JotForm API, but still you will need a custom script to get the data from your database and then forward it to JotForm.

    It should be possible to update the question with a POST method:

    http://api.jotform.com/docs/#post-form-id-question-id

    Please feel free to contact us if you need any further assistance.

  • Profile Image

    Answered by Alan on January 14, 2015 at 07:40 PM

    Mike, Thank you for your detail but I think I am still missing something in your answer because the link to the code and picture are not related to my question.  

    I have an HTTP GET link using an API to get information (names) from a database.  I have examples from other sites where people have used that API to populate a dropdown to choose from those names.

    What I can't still figure out is how to use the API link to populate the dropdown versus typing in all the possible responses.  When I add a field to my sample form there seems to be no place to add the http get link.

    Here is the sample jot form link:  http://form.jotform.us/form/50134672003139

    I have also added the API HTTP GET link to the Webhooks but also didn't see where to put the API Key

    Thanks.

  • Profile Image
    JotForm Support

    Answered by Welvin on January 14, 2015 at 09:13 PM

    I think we need your link or the codes from your HTTP GET link for us to check your method and we'll try to incorporate it to the source codes as previously mentioned by Mike.

    Also, if you can share the examples from the other sites, that would be helpful as well.

    Thanks

  • Profile Image

    Answered by kimg10 on January 14, 2015 at 09:42 PM

    Welvin,

    Thanks for your help.  The links I have are the following:

    https://www.vacationcrm.com/travelmvc/api/Service/GetAgents/ - This call retrieves the list of Agent User IDs along with their full names from VCRM for the Agency.  It is userful because in order for the proper agent to get the notifications,  the PostRequest and PostPayment calls need the correct Agent User ID.

    I have an API code as well so the database knows which Person is calling for this data.

    Here is a link showing an example of what I am trying to do from another company using the API:

    https://www.beachbumvacation.com/Reservation/Default.aspx

    If you look at the first question "Who is your Certified Travel...", that is using the call from the same https GET API I am trying to use.  Trying to do the same thing on my JotForm.  Eventually I will be trying to take the data from the form and POST the information into the same database the API is pulling from to get the agent names.

  • Profile Image
    JotForm Support

    Answered by Welvin on January 15, 2015 at 08:28 AM

    Thank you for the links and additional information. We'll look into this and get back to you.

    Regards

  • Profile Image

    Answered by Ben on January 15, 2015 at 02:10 PM

    Hi,

    Can you please tell us if the following would work for you - I know that it is not related to API calls, but would allow you to have a single point where you need to add the usernames and have everything set.

    1. populating dropdown with the list of users.

    - If you use our autocomplete widget, you can add the usernames to it and remove them as needed when you open the jotform to edit.

    2. It is userful because in order for the proper agent to get the notifications

    - You could use email templates and send an email to the right person from the jotform following these steps: How to send to a specific email address based on a selection?

    Now, looking at the entire conversation I presume that you would still like to use API calls because of the VCRM system that you are using.

    To connect your jotform with API, these are the steps that you should take:

    1. All the steps given by my colleague Mike above.

    2. Webooks integration to send the data on submission to your db again.

    Best Regards,
    Ben

  • Profile Image

    Answered by kimg10 on January 15, 2015 at 02:23 PM

    Ben,

    Unfortunately, the steps and suggestions you listed will not work.  As mentioned in the request, that list of agents MUST come directly from the database API.  If JotForm can not do that it is OK, I am just trying to see if I can stay with JotForm or I need to build from scratch moving forward.  I need to make sure the basic GET information works first before I worry about the API PUSH to the database.  I believe that will be easier but it does bring up a few other questions based on how to basically do a "data mapping" to show which JotForm fields relate to which of the API fields.

  • Profile Image
    JotForm Support

    Answered by Mike on January 15, 2015 at 02:52 PM

    We do not have any integration with the VCRM service, so unfortunately, there is no way to map the fields without custom programming. It is most likely that a .NET or JS programmer can add the integration between JotForm based form and VCRM on your website. We can also take a look into, but custom programming solution is something that we can usually work on our free time.

    The webshook just pushing the HTTP Post data to the remote URL, and that remote URL should process the data according to the script instructions. In other words, usually you need a custom script as the webhook recipient URL to process the data correctly.

  • Profile Image

    Answered by lsymms on November 11, 2016 at 11:01 AM

    You could create an external job that updates via the api 

    Example POST URI to update options:

     

    https://api.jotform.com/form/{id}/question/{qid}?question[options]=Option1|Option2|Option3