Is there a method in the API that will repopulate the fields of a form with the answers from a given submission?

  • casecrush
    Asked on August 14, 2018 at 5:22 PM
    One more question: Is there a method in the API that will repopulate the fields of a form with the answers from a given submission?
  • Elton Support Team Lead
    Replied on August 14, 2018 at 5:23 PM

    You can always do that by defining the field value in your script.

    I assume you want to add another submission to a specific through API?

    Let's assume this is the endpoint https://api.jotform.com/docs/#post-form-id-submissions

    Here's the sample PHP script.

    $jotformAPI = new JotForm("YOUR API KEY");

    $submission = array(

        "1" => "My Answer",

        "2_first" => "John",

        "2_last" => "Doe"

    );

    $result = $jotformAPI->createFormSubmission("FORM ID", $submission);

    The bold texts are the field values.

    If in case you just want to prepopulate through URL parameters, that's also possible. Guide: http://www.jotform.com/help/71-Prepopulating-the-fields-to-your-JotForm-via-URL-parameters