Skip to content

Listbox value setter v2 - #42

Merged
ukutaht merged 4 commits into
mainfrom
listbox-value-setter-v2
Oct 13, 2026
Merged

ukutaht merged 4 commits into
mainfrom
listbox-value-setter-v2

Conversation

@RobertJoonas

Copy link
Copy Markdown
Contributor

A second stab at Listbox value setter. Needed a rebase + a bunch of requested changes from the review so decided to open a new PR instead.

For more context see v1 PR: #33

RobertJoonas and others added 4 commits October 12, 2026 17:17
A native <select> fires both input and change when the user picks an
option, and so does the combobox (notifyFormChange). The listbox only
fired input, so listeners for change never saw a selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client code had to click Prima's internal option elements to change a
listbox's value without a server round-trip, e.g. to reset a row that a
separate hook hides.

The hook now handles a prima:listbox:set-value event, and
Prima.Listbox.JS.set_value/2,3,4 dispatches it from templates. Like
setting .value on a native <select>, it fires no events unless
notify: true is passed. Disabled options can be set; values with no
matching option are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shows Prima.Listbox.JS.set_value resetting a role picker, and updates the
form integration copy now that selections dispatch change as well as input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers the prima:listbox:set-value event and Prima.Listbox.JS.set_value:
value, label and marker updates, disabled options and listboxes, ignored
unknown values, and which events fire with and without notify. The form
tests check that input + change still count as a single phx-change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RobertJoonas RobertJoonas mentioned this pull request Oct 12, 2026
@ukutaht
ukutaht merged commit 5598642 into main Oct 13, 2026
2 checks passed
@ukutaht
ukutaht deleted the listbox-value-setter-v2 branch October 13, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants