Select multiple and attribute order
lachdoug opened this issue · 0 comments
lachdoug commented
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.
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
}
]
};