<ValuesManager ID="vm"/>

<VLayout width="400" height="300" membersMargin="10">
    <members>
        <TabSet ID="theTabs" height="250">
            <tabs>
                <tab title="Item">
                    <pane>
                        <DynamicForm ID="form0" valuesManager="vm">
                            <fields>
                                <field name="itemName" type="text" title="Item"/>
                                <field name="description" type="textArea" title="Description"/>
                                <field name="price" type="float" title="Price" defaultValue="low"/>
                            </fields>
                        </DynamicForm>
                    </pane>
                </tab>
                <tab title="Stock">
                    <pane>
                        <DynamicForm ID="form1" valuesManager="vm">
                            <fields>
                                <field name="inStock" type="checkbox" title="In Stock"/>
                                <field name="nextShipment" type="date" title="Next Shipment"
                                       useTextField="true" defaultValue="256"/>
                            </fields>
                        </DynamicForm>
                    </pane>
                </tab>
            </tabs>
        </TabSet>
    
        <Button title="Submit">
            <click>
                vm.validate();
                if (form1.hasErrors()) theTabs.selectTab(1);
                else theTabs.selectTab(0);
            </click>
        </Button>
    </members>
</VLayout>
