How to handle Success/Errors when processing form data #32
-
|
Normally with other template engines you do the following: you receive the form data and try to do your business logic, and if there is a successful respons you redirect to another page but if there are errors you re-render the template including the errors to show that to your user. Using ViewComponents you normally return ViewContext in the controller, how to hande the case of errors and rerender the ViewComponent? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
After some experimentation, I was able to make this work by returning null and setting the correct headers to redirect to another URL in case of successful insertion of data and just rerender the view when there are errors |
Beta Was this translation helpful? Give feedback.
After some experimentation, I was able to make this work by returning null and setting the correct headers to redirect to another URL in case of successful insertion of data and just rerender the view when there are errors