I am using formio form in angular APPlication. I have registration form in my application with several fields. In the registration form i have Sate and city dropdowns. And the state and city dropdowns values are loading from State and city formio resources. When user click on Register link while loading the form, I want to assign the state and city dropdown values from cookie variables.
I have the logic to assign load cookie variables. But i am not able to assign state and city dropdown values from cookie variables. please suggest any solution to implement cookies in form io forms.
The
customDefaultValueandcalculatedValueproperties allow you to execute JavaScript, including calls to Web APIs likelocalStorage. One possible solution here is to set acustomDefaultValuefor the select component that reads fromlocalStorageand anchangeevent handler that writes the selected value tolocalStorage.Here's a working example: https://jsfiddle.net/brendanbond/L04195tz/20/