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

    WebHook Access to the 'submissionID' value

    Asked by nitehike on January 22, 2014 at 11:10 PM

    I'm wanting to use the submission data in a database of my own, and I've been trying to get that data into a friendly version. Using POST, the only value that was getting sent to my database was the FormID, with everything else being left blank.  Instead, I'm trying to use the webhooks....and I can view everything through requestbin, but I think I'm not getting any entries into my database because I'm trying to get submissionID in the wrong way. Do you have to jcon_decode it like the other hook tags, or can you just use a POST on it? Help?

    POST submission data and
  • Profile Image
    JotForm Support

    Answered by EltonCris on January 23, 2014 at 12:07 AM

    Hi,

    Have you tried checking the Webhook guide first? https://www.jotform.com/help/245-Creating-your-first-Webhook-with-JotForm

    You can actually use POST for submissions ID. It should be:

    $_POST['submissionID'];

    But if the data is decoded to PHP variable with example ($obj variable): 

    $obj = json_decode($requestbinresult, true); 

    then the code will become:

    $obj['submissionID'];

    Let us know if you still have difficulties.

    Regards!

  • Profile Image

    Answered by nitehike on January 23, 2014 at 10:41 AM

    Yea, everyone likes to quote that getting started with webhooks guide, but it's really not as useful as it should. So if I get this straight, it returns the formID and submissionID as it's own objects, and it returns the entire block of form data as a single array?

    function stripslashes_deep($value){
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);
        return $value;
    }
    $result = stripslashes_deep($_REQUEST['rawRequest']);

    //Convert json to php variable
    $obj = json_decode($result, true);


    $submission_id = $obj['submissionID'];
    $formID = $obj['formID'];
    $doesyour = $obj['q72_doesYour'];

     

    So that should theoretically work? Or do I need to pull out submissionID and formID before striping slashes and decoding the strings? Or can I combine POST and the json decode in a single webhook page, as long as the POST stuff comes first?

  • Profile Image
    JotForm Support

    Answered by EltonCris on January 23, 2014 at 11:15 PM

    @nitehike

    My apologies for the confusion. Actually the json decode is for the rawRequest data only which does not includes the formID and the submissionsID. In other words, you can use $_POST[submissionID] directly.

    Example would be (if you're going to assign it with variables):

    $submission_id = $_POST[submissionID];

    $formID = $_POST[formID];

    Let us know if you have further questions. Regards!

  • Profile Image
    JotForm Support

    Answered by EltonCris on January 23, 2014 at 11:31 PM

    I have also updated the sample code from the guide: http://pastiebin.com/523248ea4db5e

    You can run a test here: http://form.jotformpro.com/form/31840709231954?

  • Profile Image

    Answered by nitehike on January 23, 2014 at 11:54 PM

    That's fantastic! I look forward to trying to make this work! Thanks. Should update the Webhooks guide at some point with that little morsel. Thanks again. I just wish I could get back the 25 test submissions I made on my account trying to get it to work! ;-)

  • Profile Image

    Answered by nitehike on January 24, 2014 at 12:03 AM

    And with that one little tweak the whole thing works! The way I set my database up I'm using the submissionID as my unique key, so it was critical for everything. Thanks!

  • Profile Image
    JotForm Support

    Answered by jonathan on January 24, 2014 at 05:32 AM

    @ nitehike 

    Hi,

    We are all glad to know of your satisfaction on this. And our colleague EltonCris is highly commended as well for fantastic support.

    Contact us again anytime if there is more we can help you with.

    Thanks!