Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select multiple and attribute order #176

Open
lachdoug opened this issue May 13, 2018 · 0 comments
Open

Select multiple and attribute order #176

lachdoug opened this issue May 13, 2018 · 0 comments

Comments

@lachdoug
Copy link

lachdoug commented May 13, 2018

Below are two objects that define forms with select/multiple fields.
myForm works: all three options render selected.
myForm2 differs from myForm in that on the select field the 'multiple' attribute is defined after the '$components' attribute. In this case only the last option renders as selected.

screenshot from 2018-05-13 22-26-06

I would have thought that the attribute order should not matter. Am I misunderstanding something? I can't find anything in the docs that suggests that $components must be defined after other attributes.

myForm = {
  $cell: true,
  $type: "form",
  $components: [
    {
      $type: "select",
      name: "select[]",
      multiple: true,
      $components: [
        {
          $type: "option",
          $text: "First option",
          selected: true
        },
        {
          $type: "option",
          $text: "Second option",
          selected: true
        },
        {
          $type: "option",
          $text: "Third option",
          selected: true
        },
      ]
    }
  ]
};
myForm2 = {
  $cell: true,
  $type: "form",
  $components: [
    {
      $type: "select",
      name: "select[]",
      $components: [
        {
          $type: "option",
          $text: "First option",
          selected: true
        },
        {
          $type: "option",
          $text: "Second option",
          selected: true
        },
        {
          $type: "option",
          $text: "Third option",
          selected: true
        },
      ],
      multiple: true
    }
  ]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant