liveview-native / liveview-native/liveview-client-swiftui

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

Open
#1,473 7 comments 0 reactions 1 assignee View on GitHub

@carson-katri is already working on this.

Since Oct 9, 2024.

bug
Dominant language
Swift
Stars
440
Forks
45
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.