I have a page with a multi-section form, with conditional visibility of each section based on a “Form Step” state variable (managed using buttons).
However, one of my form sections is not displaying the data that it should (specific text that references other state variables on the page) within that section. I have to click around a bit for it to update properly. Many of these state variables are numerical calculations based on values from previous sections.
Is there a way within plasmic studio to automatically update/refresh the state variables on button click? When my form is all one page (no hidden sections), everything works properly.
Can provide project details if needed. Thanks!
Hello @brian_minor,
Can you please provide your project link, the page/component where the issue happens and also a small reproduction video?
Hi @icaro_guerra , I have sent you a message with the applicable info. Thank you!
Hey @brian_minor.
I think I’ve found the issue:
You have state variables that do some calculations that depend on the form state. This form state default value is set on some Form.Item, but this Form.Item is dynamically rendered, meaning it doesn’t exist at the beginning. I believe the best solution here would be to move the inital values from these Form.Item up to the Form component initial values instead of setting it individually on each form.item (you can leave it as is and just add it to the form component too, shouldn’t be an issue).
LMK if this helps you.
That makes sense. I am a bit unclear on how to set the intitial values in that section though. Few quick followup questions:
- Do I enter those values as a JSON within the form component?
- Can I only reference the values I want to include initial values for (there are a lot of form fields)?
- For radio fields, will setting these initial values within the form component itself ALSO automatically select the applicable option once that form field is visible? Or does it just track the initial value in the form state? I would like the radio buttons to be selected with initial values where applicable.
Thanks a lot!