Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Drop Downs

Avatar

Level 2

Question on drop downs:

How does one PRE set a drop down list value with a set choice. (ie: not changing the raw data behind the drop down but choosing one value to initially display - eg: select the current yr within a group of years)

Interested in knowing how to set using

  specific text within the list

  specific value of the text selected

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

It is no different than setting a field.

DDlist.rawValue = "Value you want to set"

Paul

View solution in original post

5 Replies

Avatar

Former Community Member

In the Object palette on the Value tab there is a Default dropdown that will have all of the values that you have available for the DD. You can set an initial value there.

Paul

Avatar

Level 2

Sorry - should have been more explicit

Would like to set these values using JS and if possible, by using either the text value or the hidden value..

Avatar

Correct answer by
Former Community Member

It is no different than setting a field.

DDlist.rawValue = "Value you want to set"

Paul

Avatar

Former Community Member

The attached sets the current value of a year drop-down list based upon the current date.

Steve

Avatar

Level 2

Thanks all

from the example I could see what I was doing wrong

I found that you need to set the DD.rawValue = to the hidden value that you want, not the Display value (assuming that the 2 are different)

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----