Form validation in Phoenix Liveview validates untouched fields

Hi all,
I’m trying to setup a simple contact form with Liveview and add validation in. I have it set up and working but currently, all fields get validated and error messages shown even though they have not been touched. I have phx_change: "validate" set on the form, but really I want it to just show validation errors for the field that have been touched not the rest of the form. Is there a way to do this? I’m sure there is a simple setup method that I missed, but still new to elixir/phoenix and still finding my way around.

Cheers!

I think this is what you’re looking for: Form bindings — Phoenix LiveView v0.15.7

2 Likes

Thanks @lleger, that’s exactly what I was after, didn’t realize it was implemented like that using the helper classes but it makes sense and keeps it simple.

1 Like