I have a liveview form that is always displayed on the page. The first time a user enters data the “dirty” checking works i.e. empty fields don’t raise errors. After my submit the form resets correctly but dirty checking doesn’t kick in so I get errors reported for untouched fields.
I’m happy to paste the code but wondered if anyone else had come across this problem first.
cheers
I’m replying to my own question as I’ve been trying to come up with a solution for the last 48 hours and I’m going a little bit mad 
For context, my application is. simple budgeting app where a user can enters transactions. As the user will be entering multiple transactions at a time I wanted the transaction form to remain on the page. I didn’t want a modal as I feel that would slow down user input.
So, do any of you awesome people have a use case that is similar to mine i.e. have a form on a page remain after the user hits the submit button and if so how do you handle form reset/dirty checking.
many, many thanks in advance
What do you do after submitting? Push navigate or push patch? If not, I think the behavior you’re seeing is expected (to LV it seems as if you’re still editing the same form, with the same dirty state still attached to the form).
Hi @linusdm
I don’t do either - I simply reset the changeset and reply {:ok, socket}. However you’ve given me something to play with. I’ll give it a go with push_patch (and try push_navigate if that doesn’t work).
Many thanks
Hi @linusdm
just tried this with push_navigate and it worked like a charm.
Many thanks for the pointer.
cheers
1 Like