-
SphynxAsked on December 27, 2021 at 2:09 PM
Hi JotForm support,
I've reached out to the api@jotform.com email address and haven't had a response for several weeks. I am trying to use fetch / post to edit an existing submission. For the control matrix / input table I'm able to get the first to values to populate but the additional values aren't working.
I was able to post via a Webhook in Zapier, but since I need to dynamically populate the row index, I had to switch to Javascript / fetch. Only the first two values are populating and the rest just show as blank. Here is my code:
var query = [];
var formNum = 'submission[1040][answers]';
var formName = 'submission[844]['+rowNum+'][1]';
var ques = 'submission[844]['+rowNum+'][2]';
var cond = 'submission[844]['+rowNum+'][3]';
var em = 'submission[844]['+rowNum+'][4]';
var initials = 'submission[844]['+rowNum+'][5]';
var signatures = 'submission[844]['+rowNum+'][6]';
var PDFs = 'submission[844]['+rowNum+'][7]';
var formRedirect = 'submission[844]['+rowNum+'][8]';
var emailIntegration = 'submission[844]['+rowNum+'][9]';
var docStorage = 'submission[844]['+rowNum+'][10]';
query[formNum] = rowNum;
query[formName] = inputData.formTitle;
query[em] = 'ABC';
query[cond] = 1;
query[ques] = 77;
query [signatures] = 1;
query[initials] = 1;
query[formRedirect] = 0;
query[PDFs] = 0;
query[emailIntegration] = 0;
query[docStorage] = 0;
var params = Object.keys(query)
.map(function (k) {return encodeURIComponent(k) + '=' + encodeURIComponent(query[k])})
.join('&');
var URL = 'https://api.jotform.com/submission/'+inputData.projectID+'?'+params;
console.log(URL);
const res = fetch (URL, {
method: 'POST',
headers: {'Content-Type': 'application/json','APIKEY' : 'xxxxxxxxxxx'},
})
.then(function(res) {
return res.json();})
.then(function(json) {
callback(null, json);
});
But this is the result:
Any assistance you can provide is highly appreciated!
Thanks!!
-
Harvey JotForm SupportReplied on December 27, 2021 at 3:12 PM
Hello,
Apologies on behalf of the API team. Unfortunately, I could not respond as to why they haven't replied to your email. The best position that could help you in your concern would be the API team. You may try sending them a follow-up. They should be able to get back to you with regards to your question.
You can also send reach them out using this form: https://www.jotform.com/212704372210038
If you have any other concerns, feel free to let us know.
Happy Holidays!
-
SphynxReplied on December 27, 2021 at 3:21 PM
Thanks! Will do.