Skip to content

bug: advanced-select value reset with remote data #86

@dax

Description

@dax

What version of FlyonUI are you using?

2.0.1

Which browsers are you seeing the problem on?

All browsers

Reproduction URL

https://flyonui.com/docs/advanced-forms/advanced-select/#remote-data-selection

Describe your issue

When selecting an option of an advanced-select component, the HSSelect.value has the right selected value but the select tag has its value field reset to the first declared option (ie. the first element of the remote API response).
When embedded in a form, the SubmitEvent has not the right value. Example:

const form = document.getElementById("form");
form.addEventListener("submit", (event) => {
  const data = new FormData(event.target);
  console.log(data.get("select")); // The `select` element value of an `advanced-select` is the first `option` value, when we would expect the select value
});

Of course, it is possible to get the value from the HSSelect instance but it breaks some frameworks that rely on the standard API (e.g. FormData).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions