Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Expand To Fit for Drop-down list


Former Community Member

Hi All,

Why expand to fit option is disabled for drop-down list?

Is there any way to make the drop-down field expandable as per the data selected?

Thanks and Regards-


2 Replies


Level 9

Hi Chalukya,

Though not sure, still I guess all the values in a dropdown are pre-existing or if we use dynamic properties to update the dropdown we can know atleast what could be it's length.May be that's the reason expand options are not available.

But if you want to expand it you can do so a bit of scripting.

When we select something from the dropdown through change event we can get the vairable length. If the variable/item length is greater than a particular value then we can expand the dropdown.

In the change event of the dropdown :

You have to use FormCalc if you want to use Len otherwise you can use an array in javascript.

if(Len($event.change))   > 10


          this.w = "10inch";





Former Community Member

Hi Bibhu,

Thanks for ur reply.

May be u r right about the expand to fit option for ddl.

Your code works fine with the field width to expand, but if we try to do the same with the height the field gets expanded height wise but the data does not wrap around.

I am trying to achive this by hiding the text field and ddl one behind the other.

Thanks a lot once again.