Expand my Community achievements bar.

SOLVED

Unable to add DropDown ComboBox to LinkDialog.js

Avatar

Level 2

I have created a LinkDialogOverride.js and need to change the default:

{ "itemId": "targetBlank", "name": "targetBlank", "xtype": "checkbox", "boxLabel": CQ.I18n.getMessage("Open in new window"), "value": "targetBlank" }

To a select dropdown or combo box. I see how it can be added to a dialog through .content.xml but not for the LinkDialog.js.  Thank you in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi. For the dropdown you have to use the correct variables for a dropdown.
There are different forms of selection xtypes.You have the combo box, checkbox, dropdown menu and the radio buttons.
Xtype needs to be set to selection and the type of selection needs to be set to select (dropdown).
Then of course you also need to add the selectable values to that widget.

Here's a basic example with just two options:

 

this.myField = new CQ.form.Selection({ "fieldLabel": "MySelection", "name": this.componentName + "/" + selectionName, "type": "select", "ignoreData": true, "options": [{ "value": "true", "text": "Yes" },{ "value": "false", "text": "No" } ] });

Hope this will make some sense
/Johan
 

View solution in original post

2 Replies

Avatar

Level 10

All default values are set by assigning values to the using values to the xtype node. I am unclear - you have set the default value using a dialog - correct? 

Avatar

Correct answer by
Level 7

Hi. For the dropdown you have to use the correct variables for a dropdown.
There are different forms of selection xtypes.You have the combo box, checkbox, dropdown menu and the radio buttons.
Xtype needs to be set to selection and the type of selection needs to be set to select (dropdown).
Then of course you also need to add the selectable values to that widget.

Here's a basic example with just two options:

 

this.myField = new CQ.form.Selection({ "fieldLabel": "MySelection", "name": this.componentName + "/" + selectionName, "type": "select", "ignoreData": true, "options": [{ "value": "true", "text": "Yes" },{ "value": "false", "text": "No" } ] });

Hope this will make some sense
/Johan