Best Approach to Re-populating Multiple Choice Fields with Data from Previous Form Submit?

Hi all,

I have a friend that goes to land locations and performs environmental inspections. He typically finds 30-100 deficiencies per location he visits, he enters these into Knack using a form for the Environmental Deficiency Object I've created.

He asked me today to help him re-populate multiple choice fields once he hits the submit button. This is because he doesn't want to re-select details that don't change across records like the land location. Ideally he wants the land location, which is a multiple choice field, to equal the last land location submitted when the form reloads. 


I believe this will only be possible using the API and Javascript. Could someone please push me in the correct direction for this? Any examples would be very nice.

Thank you very much

I am now working on this same issue... 

Knack recently released 'form vars feature.'

https://www.knack.com/blog/new-feature-form-url-vars

Essentially this allows you to fill in a form value based on the url value. ( I haven't used this yet )

By pairing this with cookies you should be able to set that value.

Here is some code I wrote to set cookies based on the url base and the record ID.

You should be able to do something similar but add a var for the field value and to the redirect url value of the cookie.

 

Good luck. Hope this helps.

 

LazyLoad.js([
'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.3/js.cookie.min.js'
], function () {
$(document).on("knack-view-render.view_YOUR VIEW", function(event, view, data) {
$(document).ready(function() {
var url = window.location.href;

//GET THE RECORD ID MAY NEED ADJUSTMENT
var recordid = window.location.href.split('/')[window.location.href.split('/').length - 2];


var hasProfileUrlBase ='https://blahblahblah3/';


var noProfileUrl = 'https://www.blahblahblah/profile/';

//for testing  console.log("url is" + url);
//for testing console.log('recordid is: ' + recordid);

Cookies.set('jobUrl2', hasProfileUrlBase + recordid);
Cookies.set('jobUrl3', hasProfileUrlBase + recordid + '/view-job-listing-details4/' + recordid);
});
});
});