Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

js2form: bind list of values to multiselect #77

@Pavel-Nosov

Description

@Pavel-Nosov

js2form: list of values doesn't bind to multiselect.
Example:
I need to map object:

var x = {
    levels : ["DEBUG, ""INFO"]
};
js2form(form, x);

to the form with the control:

<select id="levels" name="levels" multiple="multiple"/>

It seems to me that js2form required select name "levels[]", but it's not correct fully.
The fix could look like addition another last "if" branch to the js2form function, I suppose:

      else if (typeof formFieldsByName[fieldName.replace(_arrayItemRegexp, '')] != 'undefined')
      {
        setValue(formFieldsByName[fieldName.replace(_arrayItemRegexp, '')], fieldValue);
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions