I am trying to set the defaultValue in a Touch UI select dropdown. Setting "defaultValue" in dialog.xml works in Classic mode, but not in Touch. Here is the relevant snippet from my component's .content.xml <alignment jcr:primaryType="cq:Widget" sling:resourceType="granite/ui/components/foundation/form/select" fieldLabel="Alignment" name="./alignment" value="option2" defaultValue="option2"> <items jcr:primaryType="cq:WidgetCollection"> <topLeft jcr:primaryType="nt:unstructured" text="Option 1" value="option1"/> <topCenter jcr:primaryType="nt:unstructured" text="Option 2" value="option2"/> <topRight jcr:primaryType="nt:unstructured" text="Option3" value="option3"/> </items> </alignment>
Solved! Go to Solution.
It seems that this is a bug with the granite select component (granite/ui/components/foundation/form/select).
The problem was also posted here, and never solved: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...
defaultValue doesnt work in Touch UI.
If you want Option 2 be set as defaultValue. try using this
Views
Replies
Total Likes
selected="{Boolean}true"
It worked fine for touch ui in AEM 6.3 but didnot work when inplace upgrade was done to upgrade to 6.5. Please advise.
Views
Replies
Total Likes
Basically, you need to add 'selected' property which takes a boolean for the option which you want. by default it will be 'false'
I've added selected="true" to the second value in the dropdown, but the first value is still selected by default.
<horizontal jcr:primaryType="cq:Widget" sling:resourceType="granite/ui/components/foundation/form/select" fieldLabel="Horizontal Alignment" name="./halign"> <items jcr:primaryType="cq:WidgetCollection"> <topLeft jcr:primaryType="nt:unstructured" text="Left" value="hleft"/> <topCenter jcr:primaryType="nt:unstructured" text="Center" value="hcenter" selected="true"/> <topRight jcr:primaryType="nt:unstructured" text="Right" value="hright"/> </items> </horizontal>
Views
Replies
Total Likes
Have you added it as a String or boolean ?
Views
Replies
Total Likes
if you are changing directly in the xml, it should be like
selected="{Boolean}true"
Views
Replies
Total Likes
I am making the change directly in the component's .content.xml, but selected="{Boolean}true" hasn't worked either. It seems to always default to the first option.
Views
Replies
Total Likes
It seems that this is a bug with the granite select component (granite/ui/components/foundation/form/select).
The problem was also posted here, and never solved: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...
Andrew Bowles wrote...
I am making the change directly in the component's .content.xml, but selected="{Boolean}true" hasn't worked either. It seems to always default to the first option.
Did you get a solution for this ? selected = true (as a boolean property) doesnt work. If you have some other solution plz share.
Views
Replies
Total Likes
I was never able to find a solution. selected="{Boolean}true" hasn't worked for me.
Views
Replies
Total Likes
Hi Loki,
selected boolean true doesnt work to set a property as a default . Can you please guide on a solution to this.
Views
Replies
Total Likes
Hi,
Checked selected={Boolean}true. works fine in AEM 6.1 with SP2 installed.
Thanks,
Bhargav
Hi,
in order to make it work isn't enough to add
forceIgnoreFreshness="{Boolean}true"
in the select node itself.
Views
Replies
Total Likes