justacoder
justacoder

Reputation: 2704

Manual Entry of Selection Options in cq:Widget

I wish to create a select field for my component, and am unable to decipher how to manually enter these options in CRXDE.

I entered the following as a property:

options (String) : [ {value: "5", text: "5" }, { value: "10", text: "10" } ]

This is not producing any results and lots of JavaScript issues in the Dialog Editor window.

I am following this documentation as a guideline, as well as the syntax: http://dev.day.com/docs/en/cq/5-4/widgets-api/index.html?class=CQ.form.Selection

Upvotes: 0

Views: 1497

Answers (2)

OmP
OmP

Reputation: 189

For your last lines.. how to manually enter these options in CRXDE?

You can create a json file that returns a Map containing text and value.

Show the text in the dropdown and use the value in JSP.

Rather than giving the text and values manually, you can add $Path to that json at options field.

Upvotes: 1

kfaerber
kfaerber

Reputation: 1327

Options for the selection xtype are done with nodes not properties.

Your node structure should be something like:

-[NodeName] - jcr:primaryType=cq:Widget, xtype=selection
  -options - jcr:primaryType=cq:WidgetCollection
    -[NodeName] - jcr:primaryType=nt:unstructured, text=[Text], value=[Value]
    -[Other options you want]...

An example to look at is: /libs/foundation/components/list/dialog/items/list/items/listFrom

Upvotes: 1

Related Questions