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

**URL:** https://forums.knack.com/t/best-approach-to-re-populating-multiple-choice-fields-with-data-from-previous-form-submit/10095
**Category:** API & Custom Code
**Created:** [January 12, 2017, 3:15am UTC](https://forums.knack.com/t/best-approach-to-re-populating-multiple-choice-fields-with-data-from-previous-form-submit/10095 "2017-01-12T03:15:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RyanPark96285](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RyanPark96285](https://forums.knack.com/u/RyanPark96285)
#### Post date: [January 12, 2017, 3:15am UTC](https://forums.knack.com/t/best-approach-to-re-populating-multiple-choice-fields-with-data-from-previous-form-submit/10095/1 "2017-01-12T03:15:37Z")

</div>

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.&nbsp;

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

---

<div class="post-metadata">

### Author: ![BrockMassi21234](https://avatars.discourse-cdn.com/v4/letter/b/9fc29f/32.png) [@BrockMassi21234](https://forums.knack.com/u/BrockMassi21234)
#### Post date: [June 26, 2018, 3:44am UTC](https://forums.knack.com/t/best-approach-to-re-populating-multiple-choice-fields-with-data-from-previous-form-submit/10095/2 "2018-06-26T03:44:14Z")

</div>

I am now working on this same issue...&nbsp;

---

<div class="post-metadata">

### Author: ![Justin11773](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@Justin11773](https://forums.knack.com/u/Justin11773)
#### Post date: [April 12, 2017, 6:54pm UTC](https://forums.knack.com/t/best-approach-to-re-populating-multiple-choice-fields-with-data-from-previous-form-submit/10095/3 "2017-04-12T18:54:51Z")

</div>

Knack recently released 'form vars feature.'

[https://www.knack.com/blog/new-feature-form-url-vars](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&nbsp;add a var for the field value and to the redirect url value of the cookie.

&nbsp;

Good luck. Hope this helps.

&nbsp;

LazyLoad.js([  
 '[https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.3/js.cookie.min.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/](https://www.shyftcareers.com/login/#job-listings-03/job-listing-details3/)';

var noProfileUrl = '[https://www.blahblahblah/profile/](https://www.shyftcareers.com/candidate-profile/)';  
   
//for testing &nbsp;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);  
 });  
 });  
});
