Submitting the same form content when using use:enhance
results in form fields
being cleared between submits.
- Install
npm install
npm run dev
-
Browse to
http://localhost:5173
-
Enter
hello
in first field,world
in second field. -
Press
Submit
. -
hello world
is printed underneath the form. First field containshello
, second field containsworld
. Server prints:{ first: 'hello', last: 'world' }
-
Press
Submit
. -
hello world
is printed underneath the form. Fields are now empty. Server prints:{ first: 'hello', last: 'world' }
-
Press
Submit
. -
Nothing printed underneath form. Fields are empty. Server prints:
{ first: '', last: '' }
Fields should never lose their content.
- Chat form with room and message field: the room may not change, but the message does. We want to keep the room between form submits.