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

  • Profile Image
    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?

  • Profile Image
    Adrian
    Answered 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

    15233769671.png

  • Profile Image
    apago
    Answered on April 10, 2018 at 03: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.

  • Profile Image
    Richie_P
    Answered on April 10, 2018 at 04: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.

  • Profile Image
    apago
    Answered on April 10, 2018 at 07:21 PM

    Neither of those articles answer my question.

  • Profile Image
    Mike
    Answered 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.