Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Trying to alter drop down menu

Avatar

Level 2

I am creating a form that uses a lot of drop down menus and I am trying to have the drop down show the descriptions and have the box actually populated with a part number instead of description. I am not against XML coding if needed I am new to it but have played around a little bit. Any ideas or direction would be much appreciated thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Yes. Put the descriptions in the drop down menu and then specify values in the binding tab. In the exit event for the drop down menu put the code (in formcalc):

if ($.rawValue == 1) then

    $.formattedValue = "109323" // put whatever the part number is in here

elseif ($.rawValue == 2) then

    $.formattedValue = "109324" // etc

endif

the rawValue is the value of the option the person has chosen in the menu and the formattedValue is what the box will show once the exit event has executed.

View solution in original post

6 Replies

Avatar

Level 10

You can have a display value and selected value for the drodpdowns. In the object properties, and in Field tab, you can specify the display values for the dropdown. In the Binding tab, you can specify the values for each value. This way when a user selects an option from the dropdown, the value will be passed instead of description in the submitted XML.

Thanks

Srini

Avatar

Level 2

Thank you Srini

I did see this option but this data isn't being submitted per say they are just going to fill out the form and print it to a paper copy that will be  passed off to the next person to process and file manually. So what I have done is put both description and part ID in the drop down but it makes for a very long text that can't always be completely displayed. Is there a way to have it display one thing and have it save something different in the box that is displayed for printing?

Avatar

Correct answer by
Level 7

Yes. Put the descriptions in the drop down menu and then specify values in the binding tab. In the exit event for the drop down menu put the code (in formcalc):

if ($.rawValue == 1) then

    $.formattedValue = "109323" // put whatever the part number is in here

elseif ($.rawValue == 2) then

    $.formattedValue = "109324" // etc

endif

the rawValue is the value of the option the person has chosen in the menu and the formattedValue is what the box will show once the exit event has executed.

Avatar

Level 2

First off thank you very much this sounds like it is exactly what i am looking for would it be possible to get an example to see how the code is added into the XML string

Avatar

Level 2

Ok so I got the code in and it works but I get "calculation override" do you want to edit this text yes/no whenever I use the drop down menu

is there a way to disable this error

Avatar

Level 2

Figured out error was being caused by value being set wrong must be set to Type: User Entered - Optional then error goes away