Retrieve/populate choices for dropdown by calling a REST API?

  • apago
    Asked on April 10, 2018 at 11:26 AM

    Hello,

    Is it possible to call a REST API to retrieve the choices for a select form item?

  • Adrian
    Replied on April 10, 2018 at 12:17 PM

    Yes, it is possible to retrieve the choices (options) of a form item (question) by making an API call.

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

    Here is an example. You can see the choices (options) of the select item in the response.

    Form URL: https://form.jotform.com/80995358446977

    Retrieve/populate choices for dropdown by calling a REST API? Image 10

  • apago
    Replied on April 10, 2018 at 3:43 PM

    Thank you for the response; however, I meant the opposite of your answer.

    I need to retrieve the actual choices that will be displayed to the user in a select by calling a REST API. Not retrieve the predefined choices defined in the form builder.

  • Richie JotForm Support
    Replied on April 10, 2018 at 4:08 PM

    Have your tried using -Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page

    then use your data in your custom script to perform the custom function. You could also try,-How-to-send-Submissions-to-Your-MySQL-Database-Using-PHP

    Hope this helps.


    Please let us know if we can be of further assistance.

  • apago
    Replied on April 10, 2018 at 7:21 PM

    Neither of those articles answer my question.

  • Mike
    Replied on April 10, 2018 at 10:09 PM

    1) It is possible to get a form source code and modify it. You can add your own code to populate the dropdown items. The modified code will be hosted on your web page in this case.

    How to get the Full Source Code of your Form

    2) The form dropdown items can be also modified with JotForm API, see:

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

    Example:

    curl -X POST -d "question[options]=Option1|Option2|Option3|Option4" "https://api.jotform.com/form/{formID}/question/{questionID}?apiKey={apiKey}"

    Thank you.