kaquadu

kaquadu

Sending parameters with submit doesn't work

Hi,
I’ve got very long form for submitting table search - its code is partially pasted below. As title says - submitting doesn’t send its name and value parameters. There is a code of my form:

<form action="#" phx-submit="search" id="search-form">

<%= label :city, gettext("City") %>
<%= text_input :params, :city, value: @form_vals.city %>

<%= label :range, gettext("Range") %>
<%= number_input :params, :range, value: @form_vals.range %>

... many other params ...

<%= label :page_size, gettext("Page size") %>
<%= select :params, :page_size, [5, 10, 20, 50, 100], value: @page_size %>

<%= submit gettext("Search"), value: @page_number, name: "page", phx_disable_with: gettext("Searching...") %> <br>

<%= submit gettext("Previous page"), value: @page_number+1, name: "page", phx_disable_with: gettext("Loading...") %>
Page: <%= @page_number %>, total pages: <%= @total_pages %>
<%= submit gettext("Next page"), value: @page_number-1, name: "page", phx_disable_with: gettext("Loading...") %>

</form>

The behaviour I want to achieve is to get %{"page" => number} with parameters in my liveview event handler. Rest of the parameters is passed. No clue why it doesn’t work for submit button value.

Most Liked

l00ker

l00ker

You might be better off to just use hidden_input/3 in this case.

Where Next?

Popular in Questions Top

New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New

We're in Beta

About us Mission Statement