You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
x9sim9
changed the title
When Submitting Advanced Select with apiUrl the title is submitted instead of the value (Fix included)
When Submitting Advanced Select with apiUrl the title is submitted instead of the value
Oct 27, 2024
The API returns an array of JSON objects, e.g., {id: "1000420", name: "FM Q3 MENS FALL 1 2025"}.
The configuration apiFieldsMap: { "id": "id", "title": "name" } maps the fields, but data-value ends up set to the title instead of the id.
Suggested Solution
Add an option to allow data-value to be mapped to data-id instead of title, so that data-value reflects the id field for submissions. This would improve compatibility for cases where the id field is the preferred submit value.
Summary
The select submits the title instead of the value when using apiUrl
Steps to Reproduce
https://preline.co/docs/advanced-select.html#remote-data
Using the example provided, its setting the option values like this
<option value="Essence Mascara Lash Princess" data-id="1"
instead of like this
<option value="1" data-id="1"
Demo Link
https://preline.co/docs/advanced-select.html#remote-data
Expected Behavior
<option value="1" data-id="1"
Actual Behavior
<option value="Essence Mascara Lash Princess" data-id="1"
Screenshots
The text was updated successfully, but these errors were encountered: