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

Maximum value in field based on dropdown menu selection in another field

sittingfairy2
Level 1
Level 1

Hi,

I am trying to set a maximum value in a field based on a selection from a drop down menu in another field. In other words, there are three selections in the drop down menu (0-2, 2-10, and 10+). If they select 0-2 then the maximum amount allowed in another field is 10. If they select  2-10 then the maximum amount is 15 and if they enter 10+ then the maximum amount is 22. I would like a message box to appear and state that the amount of maximum vacation is .... only if the amount in that field exceeds the maximum value.

If the amount in field2 exceeds the maximum value it should be reduced to the maximum amount based on their selection from the drop down menu.

Field1 is the dropdown menu field

Field2 is the field with the maximum value based on the dropdown menu selection (By the way, field2 is automatically calculated from two different fields so people will not be able to manually input it)

This is the script I have so far and it is not working. I am also not sure if javascript or formcalc is better. I am adding the script to field2 where the maximum amount rule applies. Thanks in advance for any assistance!

if (filed1.rawValue eq "0-2") and if (field2.rawValue>10) then

          xfa.host.messageBox("Maximum Vacation Time is 10");

             

              this.rawValue = 10;}

    elseif (field1.rawValue eq "2-10") and if (field2.rawValue>15) then

          xfa.host.messageBox("Maximum Vacation Time is 15");

             

              field2.rawValue = 15;

             

    elseif (topmostSubform.Page1.P[0].DropDownList1.rawValue eq "10+") and if (field2.rawValue>22) then

          xfa.host.messageBox("Maximum Vacation Time is 22");

             

              field2.rawValue = 22;

endif

0 Replies