Expand my Community achievements bar.

SOLVED

How to set "defaultValue" for xtype tags.

Avatar

Level 2

Hi, I am not abel to set defaultValue to xtype tags. Can any of one have idea please help me.

I tried with defaultValue property is not working.

And addTag method is adding tags but iam getting validation error. Please go through attachment.

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Is the xtype in your pic a CQ.Ext.form.ComboBox or a CQ.wcm.ContentFinder

If you are using a combo box in a custom xtype - you can use code like:


// create the combo instance
var combo = new CQ.Ext.form.ComboBox({
    typeAhead: true,
    triggerAction: 'all',
    lazyRender:true,
    mode: 'local',
    store: new CQ.Ext.data.ArrayStore({
        id: 0,
        fields: [
            'myId',
            'displayText'
        ],
        data: [[1, 'item1'], [2, 'item2']]
    }),
    valueField: 'myId',
    displayField: 'displayText'
});


The Combo Box API has a default value setting to: 

[img]Combobox.png[/img]

We have an article on how to use this ComboBox API within a custom xtype:

http://helpx.adobe.com/experience-manager/using/creating-custom-xtype.html

However - there is no such API that maps to an "xtype tag". You can get a value from a combo box in a custom xtype. Then you can use the AEM TagManager API and create a tag based on that value. See these docs:

http://wem.help.adobe.com/enterprise/en_US/10-0/wem/developing/tagging.html

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Is the xtype in your pic a CQ.Ext.form.ComboBox or a CQ.wcm.ContentFinder

If you are using a combo box in a custom xtype - you can use code like:


// create the combo instance
var combo = new CQ.Ext.form.ComboBox({
    typeAhead: true,
    triggerAction: 'all',
    lazyRender:true,
    mode: 'local',
    store: new CQ.Ext.data.ArrayStore({
        id: 0,
        fields: [
            'myId',
            'displayText'
        ],
        data: [[1, 'item1'], [2, 'item2']]
    }),
    valueField: 'myId',
    displayField: 'displayText'
});


The Combo Box API has a default value setting to: 

[img]Combobox.png[/img]

We have an article on how to use this ComboBox API within a custom xtype:

http://helpx.adobe.com/experience-manager/using/creating-custom-xtype.html

However - there is no such API that maps to an "xtype tag". You can get a value from a combo box in a custom xtype. Then you can use the AEM TagManager API and create a tag based on that value. See these docs:

http://wem.help.adobe.com/enterprise/en_US/10-0/wem/developing/tagging.html