How to use SimpleSelect in Widgets in PSUv5

Product: PowerShell Universal
Version: 5.1.2

Hello, did anyone try the new SimpleSelect in the Widgets yet? We don’t seem to be able to make it work. By that I mean the select form item shows up, but adding SimpleSelectOption nodes into it does nothing, the select is options are empty no matter what we tried and sadly documentation is nonexistent for this component yet, just as many other Widget components sadly. It’s pretty tough to try to implement anything besides besic stuff.

Adding our current snippet where we try basically all SimpleSelectOption attributes and yet the result is empty list.

<Row>
    <Col Style="margin-left: 20px; width: 650px; padding: 5px;">
        <Form Model="$Model" OnFinish="Submit" Style="background: white; padding: 20px;">
           ...
            <FormItem Label="Licence" Required="true">
                <SimpleSelect bind-Value="$Model.Licence">
                    <SimpleSelectOption Id="Licence1" Item="Licence1" Label="Licence1" Value="Licence1">Licence1</SimpleSelectOption>
                    <SimpleSelectOption Id="Licence2" Item="Licence2" Label="Licence2" Value="Licence2">Licence2</SimpleSelectOption>
                </SimpleSelect>
            </FormItem>
           ...
        </Form>
    </Col>
</Row>

Thanks for help in advance

This took me some time to figure out the other day. Wrap the SimpleSelectOptions with SelectOptions like this:

<Row>
    <Col Style="margin-left: 20px; width: 650px; padding: 5px;">
        <Form Model="$Model" OnFinish="Submit" Style="background: white; padding: 20px;">
           ...
            <FormItem Label="Licence" Required="true">
                <SimpleSelect bind-Value="$Model.Licence">
					<SelectOptions>
						<SimpleSelectOption Id="Licence1" Item="Licence1" Label="Licence1" Value="Licence1">Licence1</SimpleSelectOption>
						<SimpleSelectOption Id="Licence2" Item="Licence2" Label="Licence2" Value="Licence2">Licence2</SimpleSelectOption>
					</SelectOptions>
                </SimpleSelect>
            </FormItem>
           ...
        </Form>
    </Col>
</Row>
1 Like

Awesome! Thank you! Just posting the working code for others to have reference. SimpleSelectOption apparently does not support child nodes, so our final working code is this:

<Row>
    <Col Style="margin-left: 20px; width: 650px; padding: 5px;">
        <Form Model="$Model" OnFinish="Submit" Style="background: white; padding: 20px;">
           ...
            <FormItem Label="Licence" Required="true">
                <SimpleSelect bind-Value="$Model.Licence">
					<SelectOptions>
						<SimpleSelectOption Label="Licence1" Value="Licence1" />
						<SimpleSelectOption Label="Licence2" Value="Licence2" />
					</SelectOptions>
                </SimpleSelect>
            </FormItem>
           ...
        </Form>
    </Col>
</Row>