Skip to content

Select multiple and attribute order #176

@lachdoug

Description

@lachdoug

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
    }
  ]
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions