Open achinaou opened 1 month ago
When using the extension json-enc with HTMX 2.0.0, the serialization of the selected options to JSON keeps only the last selected option.
Given this HTML:
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/htmx.org@2.0.0"></script> <script src="https://unpkg.com/htmx-ext-json-enc@2.0.0/json-enc.js"></script> </head> <body> <form hx-ext="json-enc" hx-post="/json"> <select id="fruits" name="fruits" multiple="multiple"> <option value="apple" selected="selected">Apple</option> <option value="banana" selected="selected">Banana</option> <option value="cherry">Cherry</option> </select> <button type="submit">Submit</button> </form> </body> </html>
The JSON payload will be this:
{ "fruits": "banana" }
What else I tested and worked as expected:
So, the issue only exists in the combination of HTMX 2.0.0 and the json-enc extension.
Same here. I've also raised an issue: https://github.com/bigskysoftware/htmx-extensions/issues/58
When using the extension json-enc with HTMX 2.0.0, the serialization of the selected options to JSON keeps only the last selected option.
Given this HTML:
The JSON payload will be this:
What else I tested and worked as expected:
So, the issue only exists in the combination of HTMX 2.0.0 and the json-enc extension.