To the dialog of a custom submit action I want to add a dropdown that gets its options dynamically from a javascript function.
The xml for the dialog item is:
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Widget" name="...." fieldLabel="...." fieldDescription="...." allowBlank="true" type="select" xtype="selection" optionsProvider="function() { return [{value:'1',text:'One'},{value:'2',text:'Two'}];}"/>
This does not work!
But the variant below works:
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Widget" name="..." fieldLabel="..." fieldDescription="..." allowBlank="true" type="select" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <one jcr:primaryType="nt:unstructured" text="One" value="1" /> <two jcr:primaryType="nt:unstructured" text="Two" value="2" /> </options> </jcr:root>
I have no clue why the first configuration is not working. 'optionsProvider' is a configuration option documented at http://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html.
Can somebody explain why the first configuration is not working?