Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Need Help with a drop down list

Avatar

Level 2

Hi i have a form that uses a drop down list to change a date/time field that has been working for a long time but has recently stoped working.

The drop down list has 5 selections that change a date in the date/time field based off another date/time field untill recently has worked fine but now when selection 3-5 are selected the date shown is for example 1-14-1900.

Here is the code used

if (DropDownList1.rawValue == "1")then

          form1.Table2.Row3.DateTimeField1.formattedValue

 

elseif (DropDownList1.rawValue == "2")then

          form1.Table2.Row3.DateTimeField1.formattedValue

 

elseif (DropDownList1.rawValue == "3")then

          Num2Date((Date2Num(form1.Table2.Row3.DateTimeField1.formattedValue, "MMM DD, YYYY") + 14), "MMM DD, YYYY")

 

elseif (DropDownList1.rawValue == "4")then

          Num2Date((Date2Num(form1.Table2.Row3.DateTimeField1.formattedValue, "MMM DD, YYYY") + 21), "MMM DD, YYYY")

 

elseif (DropDownList1.rawValue == "5")then

          Num2Date((Date2Num(form1.Table2.Row3.DateTimeField1.formattedValue, "MMM DD, YYYY") + 25), "MMM DD, YYYY")

 

else null

 

endif

Any help would be appriciated.

5 Replies

Avatar

Level 7

You have a space in the word 'value' in 'formattedVal ue' for boxes 3-5.

Avatar

Level 2

In the code on the form there is no space i am not sure why it has on there as i copy and pasted the code here.

Avatar

Level 7

You haven't said where you are putting this code, but if it is in a third field (where you want the results to go) then try this:

if (DropDownList1.rawValue == 1)then

         $ = form1.Table2.Row3.DateTimeField1.formattedValue

elseif (DropDownList1.rawValue == 2)then

         $ = form1.Table2.Row3.DateTimeField1.formattedValue

elseif (DropDownList1.rawValue == 3)then

         $ = Num2Date((Date2Num(form1.Table2.Row3.DateTimeField1.formattedValue, "MMM DD, YYYY") + 14), "MMM DD, YYYY")

elseif (DropDownList1.rawValue == 4)then

          $ = Num2Date((Date2Num(form1.Table2.Row3.DateTimeField1.formattedValue, "MMM DD, YYYY") + 21), "MMM DD, YYYY")

elseif (DropDownList1.rawValue == 5)then

         $ =  Num2Date((Date2Num(form1.Table2.Row3.DateTimeField1.formattedValue, "MMM DD, YYYY") + 25), "MMM DD, YYYY")

else null

endif

Avatar

Level 2

This code has the same problem as the one i have.

The code is in the second  date field that is a due date which depends on the inpute of the dropdown list and the current date that is in the first date field.