Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

xtype combo / selection with dynamic options in submit action dialog

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

15-10-2015

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

15-10-2015

I've found a working solution on my own:

<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="PROPERTY-NAME" fieldLabel="FIELD-LABEL" fieldDescription="..." type="select" xtype="selection" allowBlank="true"> <listeners jcr:primaryType="nt:unstructured" beforerender="function(){this.setOptions([{value:&quot;1&quot;,text:&quot;one&quot;},{value:&quot;2&quot;,text:&quot;two&quot;}])}"/></jcr:root> </jcr:root>

This is the configuration of a drop down list labeled as 'FIELD-LABEL' with two items 'one' and 'two'. The value either '1' or '2' of the selected item will be reflected in the property 'PROPERTY-NAME' among the submitted properties.

Answers (0)