fix(gaiia): wrap manufacturer select in form for phx-change to pick up name attr
A bare <select phx-change="..."> sends %{"value" => ...}, not the name
attribute. Wrapping in <form phx-change="..."> fixes this so the handler
receives %{"manufacturer_id" => value}.
This commit is contained in:
parent
8db9fb4fcd
commit
40dadededd
1 changed files with 16 additions and 15 deletions
|
|
@ -185,21 +185,22 @@
|
|||
<td class="whitespace-nowrap px-4 py-3 text-right text-sm">
|
||||
<%= if @open_create_for == entry.device.id do %>
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
<select
|
||||
phx-change="select_manufacturer"
|
||||
name="manufacturer_id"
|
||||
class="rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 dark:border-white/10 dark:bg-gray-800 dark:text-gray-300"
|
||||
>
|
||||
<option value="">{t("Select manufacturer")}</option>
|
||||
<%= for mfr <- @manufacturers do %>
|
||||
<option
|
||||
value={mfr["id"]}
|
||||
selected={@selected_manufacturer == mfr["id"]}
|
||||
>
|
||||
{mfr["name"]}
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
<form phx-change="select_manufacturer">
|
||||
<select
|
||||
name="manufacturer_id"
|
||||
class="rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 dark:border-white/10 dark:bg-gray-800 dark:text-gray-300"
|
||||
>
|
||||
<option value="">{t("Select manufacturer")}</option>
|
||||
<%= for mfr <- @manufacturers do %>
|
||||
<option
|
||||
value={mfr["id"]}
|
||||
selected={@selected_manufacturer == mfr["id"]}
|
||||
>
|
||||
{mfr["name"]}
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</form>
|
||||
<%= if @selected_manufacturer do %>
|
||||
<form
|
||||
phx-submit="create_gaiia_item"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue