How to set default value in a Touch UI select element? | Community
Skip to main content
andrew_bowles
New Participant
November 2, 2015
Solved

How to set default value in a Touch UI select element?

  • November 2, 2015
  • 13 replies
  • 32557 views
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>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by andrew_bowles

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-manager.topic.html/forum__vhse-hi_default_value.html

13 replies

New Participant
October 28, 2024

Use " emptyText" property 

 

New Participant
June 10, 2021

Hi,

in order to make it work isn't enough to add 

selected="{Boolean}true" 
in the option you want as default, you have also to set

forceIgnoreFreshness="{Boolean}true"

in the select node itself.

BhargavThogata
New Participant
April 20, 2016

Hi,

Checked selected={Boolean}true. works fine in AEM 6.1 with SP2 installed.

 

Thanks,

Bhargav

New Participant
February 25, 2016

Hi Loki,

selected boolean true doesnt work to set a property as a default . Can you please guide on a solution to this.

andrew_bowles1
New Participant
February 24, 2016

I was never able to find a solution. selected="{Boolean}true" hasn't worked for me. 

New Participant
February 24, 2016

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.

andrew_bowles
andrew_bowlesAuthorAccepted solution
New Participant
November 10, 2015

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-manager.topic.html/forum__vhse-hi_default_value.html

andrew_bowles
New Participant
November 9, 2015

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.

Lokesh_Shivalingaiah
New Participant
November 9, 2015

if you are changing directly in the xml, it should be like

selected="{Boolean}true"

Lokesh_Shivalingaiah
New Participant
November 9, 2015

Have you added it as a String or boolean ?