Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

How to make first Field Disable in dropdown

Avatar

Level 3

Dear all,

 

I have 4 static values in my dropdown, like below

 

subnaik_0-1681916049598.png

 

subnaik_1-1681916220657.png

 

Here my requirement is that I want to make first field should be always HomePage Section and it should be disabled always.

 

How can I do this ?

3 Replies

Avatar

Level 6

@subnaik You just simply need to set "disabled" property as true on the option that you want to disable. This property is of Boolean type.

Here is the documentation.

https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/...

 

Avatar

Level 3

Hi All and @salamswapnil ,

 

I am following the same documentation only .

But my requirement is that Homepage Section always be in the first option and always be disabled like below

 

subnaik_0-1681951909702.png

 

and also in some post I got below also highlighted in yellow.

 

subnaik_1-1681952129929.png

But id I will use disabled (boolean ) = true then my all dropdown field is coming as disabled. That i do not want.

 

 

Avatar

Community Advisor

Hello @subnaik ,

If I understand your requirement correctly, you want to make the Homepage option selected and disable it at a time. And if the author wants he can choose other options too. If so, you can use the selected and disabled options at a time.

<home-page                                                               
    jcr:primaryType="nt:unstructured"
    text="Home Page Selection"
    selected="true"                                                                
    disabled="true"
    value="home-page"/>