You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OrchardCore.Forms will store model state in a cookie so in the event the form is invalid the user can be redirected back to the form with the model state still intact.
Add a new form widget to the "content" zone and "always" layer. In the form's flow:
Add the Validation Summary widget.
Add the Input widget.
Name: MyName
ID: MyName
Label option: Standard
Label text: Name
Type: Input
Validation option: Standard
Add the Input widget.
Name: MyCheckbox
ID: MyCheckbox
Label option: Standard
Label text: Click me
Type: Checkbox
Validation option: Standard
Add the Button widget
Name: MyButton
ID: MyButton
Text: Submit
Type: Submit
Add a new workflow like the image below. The idea is to submit the form and force a validation error on the checkbox, then redirect back to the form to display the error.
Copy the action from the Http Request Event and set that as the form action back in the form widget.
Uncheck "validate antiforgery token" from the Http Request Event.
If you get stuck I modified the example "contact" form from the OC docs
View the form
Fill out the form
Submit the form. The text input state is preserved. The checkbox state is not preserved.
Expected behavior
Checkbox state is preserved across the redirect (the checkbox remains checked if it was checked when submitted).
The text was updated successfully, but these errors were encountered:
Describe the bug
OrchardCore.Forms will store model state in a cookie so in the event the form is invalid the user can be redirected back to the form with the model state still intact.
Orchard Core version
Main branch as of 05bd65a
To Reproduce
If you get stuck I modified the example "contact" form from the OC docs
View the form
Fill out the form
Submit the form. The text input state is preserved. The checkbox state is not preserved.
Expected behavior
Checkbox state is preserved across the redirect (the checkbox remains checked if it was checked when submitted).
The text was updated successfully, but these errors were encountered: