Skip to content

Commit a6921d9

Browse files
committed
Document phx-value- event "value" precendence
Closes #4139.
1 parent 42c790a commit a6921d9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

guides/client/bindings.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ sent to the server will be chosen with the following priority:
5454
def handle_event("inc", %{"myvar1" => "val1", "myvar2" => "val2"}, socket) do
5555
5656
If the `phx-value-` prefix is used, the server payload will also contain a `"value"`
57-
if the element's value attribute exists.
57+
if the element's value attribute exists. Note that if the element has a `value` property,
58+
like the `<li>` element, it takes precedence over `phx-value-value`. If you need to overwrite
59+
the `"value"` key in the payload, you can use `Phoenix.LiveView.JS.push/3` with its `value` option.
5860
5961
* The payload will also include any additional user defined metadata of the client event.
6062
For example, the following `LiveSocket` client option would send the coordinates and

0 commit comments

Comments
 (0)