Open eiffel205566 opened 1 month ago
State does lack 'prevState', so your example is not working. Maybe you could be so nice and add your whole solution to this problem.
State does lack 'prevState', so your example is not working. Maybe you could be so nice and add your whole solution to this problem.
did you type State accordingly?
One of the burning question after following Chapter 14 of adding server-side data validation is that: it would be really helpful if we do not ask user to refill the form from scratch when submission fails due to data violation... it would be much better if we can show (extremely helpful for beginners) how we can return the filled data back with server action function and use that to fill the form.
Thanks for posting this excellent solution! It is extremely helpful.
Linked issue :
One of the burning question after following Chapter 14 of adding server-side data validation is that: it would be really helpful if we do not ask user to refill the form from scratch when submission fails due to data violation, an example could be that say user had picked a customer and entered an amount but forget to pick a "state", and then click on "create invoice", instead of wiping out the whole form, and ask user to start from scratch, it would be much better if we can show (extremely helpful for beginners) how we can return the filled data back with server action function and use that to fill the form.
so something like this:
Also, it seems that setting the previously picked customer correct in "select" when server action failed is very tricky, and it took very long time for me to get a version working with: