1

In a liveview, I have a form that is defined like this:

<.form let={f} for={:user} action={Routes.user_path(@socket, :create)} phx-change="validate_changeset" phx-debounce="blur", as={:user}>

...

</.form>

The submit button looks like this:

<%= submit "Save", phx_disable_with: "Saving...", disabled: {"#{!@trigger_variable_when_changeset_is_valid}"}%>.

All this is fine and dandy, but as soon as the trigger variable evaluates to true, all the fields in the form get cleared out and the button is disabled again. Can anyone explain this behavior and does anyone have a solution for this?

paulrusu
  • 117
  • 1
  • 7
  • Can you add more context to the question? Maybe include the `validate_changeset ` function which I assume is where @trigger_variable_when_changeset_is_valid changes and some of the input fields maybe? – Ismael Abreu Mar 24 '23 at 15:24

0 Answers0