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 customDefaultValue
and calculatedValue
properties allow you to execute JavaScript, including calls to Web APIs like localStorage
. One possible solution here is to set a customDefaultValue
for the select component that reads from localStorage
and an change
event handler that writes the selected value to localStorage
.
Here's a working example: https://jsfiddle.net/brendanbond/L04195tz/20/