Skip to content

[Bug]: Button click event change value in input form #1473

@pierre2202

Description

@pierre2202

What happened?

`  <.simple_form for={@form} id="login_form" action={~p"/users/log_in"} method="post">

<.input style="frame(width: 225) disabled(true)"  field={@form[:pin]}  value={@pin} type="SecureField" label="Pin"> </.input> 
<.simple_form/>
 <Button  phx-click="1" phx-value-v="1" >1 </Button>

Hello , when i click on the button in macos lvngo the value doesnt change all the time,
in ios lvngo the first time value dont change but after the value change with a gap.
The problem is only in a form.

if i write this code all is ok but that is not normal

def handle_event("1", %{"v" => v}, socket) do
    send(self(), "test")
    cond do
      v == "cancel" ->
        s = String.length(socket.assigns.pin)
        s = String.slice("elixir", 0, s-1)

        {:noreply,  socket |> assign(pin: s)}
      v == "reset" ->
        {:noreply,  socket |> assign(pin: "")}

        true ->
  {:noreply,  socket |> assign(pin: socket.assigns.pin <> v)}

      end

end

def handle_info("test", socket) do

  {:noreply, socket |>  push_patch(to: ~p"/users/log_in")}

end

Library Version

last

Xcode Version

last

Swift Version

last

On which device or simulator are you running into the problem?

iPhone, MacOS

Target Device Operating System Version

last

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions