These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

IF/THEN based on Dropdown field Value

MFARRELL
Registered: Aug 17 2010
Posts: 17

Hello everyone,

I have a drop down field that has 16 different values(from "One" to "Sixteen"). I have a script that shows 4 fields and set mandatory for them depending on when value is returned.

IE -- One is selected only 4 fields get shown and set required...Two is selected 8 fields are shown and required...so on and so forth

When i build it for the "One" value it works fine and dandy but when i add the If/Then for the "Two" that one works but the previous "ONE" doesn't. Im baffled.

Also would there be an easier way to do this because this exit script is going to be long as all hell!

Heres my script. Check it out and Thank you.

form1.WDF.NUMLOANS::exit - (FormCalc, client)
if ($.rawValue == "One") then
form1.WDF.Table1.Row1.CLIREF1.presence = "visible"
form1.WDF.Table1.Row1.AMOUNT1.presence = "visible"
form1.WDF.Table1.Row1.LOAN1.presence = "visible"
form1.WDF.Table1.Row1.INTRATE1.presence = "visible"
form1.WDF.Table1.Row1.CLIREF1.mandatory = "error"
form1.WDF.Table1.Row1.AMOUNT1.mandatory = "error"
form1.WDF.Table1.Row1.LOAN1.mandatory = "error"
form1.WDF.Table1.Row1.INTRATE1.mandatory = "error"
else
form1.WDF.Table1.Row1.CLIREF1.presence = "invisible"
form1.WDF.Table1.Row1.AMOUNT1.presence = "invisible"
form1.WDF.Table1.Row1.LOAN1.presence = "invisible"
form1.WDF.Table1.Row1.INTRATE1.presence = "invisible"
form1.WDF.Table1.Row1.CLIREF1.mandatory = "disabled"
form1.WDF.Table1.Row1.AMOUNT1.mandatory = "disabled"
form1.WDF.Table1.Row1.LOAN1.mandatory = "disabled"
form1.WDF.Table1.Row1.INTRATE1.mandatory = "disabled"
endif
if ($.rawValue == "Two") then

form1.WDF.Table1.Row1.CLIREF1.presence = "visible"
form1.WDF.Table1.Row1.AMOUNT1.presence = "visible"
form1.WDF.Table1.Row1.LOAN1.presence = "visible"
form1.WDF.Table1.Row1.INTRATE1.presence = "visible"
form1.WDF.Table1.Row1.CLIREF1.mandatory = "error"
form1.WDF.Table1.Row1.AMOUNT1.mandatory = "error"
form1.WDF.Table1.Row1.LOAN1.mandatory = "error"
form1.WDF.Table1.Row1.INTRATE1.mandatory = "error"
form1.WDF.Table1.Row2.CLIREF2.presence = "visible"
form1.WDF.Table1.Row2.AMOUNT2.presence = "visible"
form1.WDF.Table1.Row2.LOAN2.presence = "visible"
form1.WDF.Table1.Row2.INTRATE2.presence = "visible"
form1.WDF.Table1.Row2.CLIREF2.mandatory = "error"
form1.WDF.Table1.Row2.AMOUNT2.mandatory = "error"
form1.WDF.Table1.Row2.LOAN2.mandatory = "error"
form1.WDF.Table1.Row2.INTRATE2.mandatory = "error"
else
form1.WDF.Table1.Row1.CLIREF1.presence = "invisible"
form1.WDF.Table1.Row1.AMOUNT1.presence = "invisible"
form1.WDF.Table1.Row1.LOAN1.presence = "invisible"
form1.WDF.Table1.Row1.INTRATE1.presence = "invisible"
form1.WDF.Table1.Row1.CLIREF1.mandatory = "disabled"
form1.WDF.Table1.Row1.AMOUNT1.mandatory = "disabled"
form1.WDF.Table1.Row1.LOAN1.mandatory = "disabled"
form1.WDF.Table1.Row1.INTRATE1.mandatory = "disabled"
form1.WDF.Table1.Row2.CLIREF2.presence = "invisible"
form1.WDF.Table1.Row2.AMOUNT2.presence = "invisible"
form1.WDF.Table1.Row2.LOAN2.presence = "invisible"
form1.WDF.Table1.Row2.INTRATE2.presence = "invisible"
form1.WDF.Table1.Row2.CLIREF2.mandatory = "disabled"
form1.WDF.Table1.Row2.AMOUNT2.mandatory = "disabled"
form1.WDF.Table1.Row2.LOAN2.mandatory = "disabled"
form1.WDF.Table1.Row2.INTRATE2.mandatory = "disabled"
endif

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Carefully think about what is happening. If the value is "One" the block of code for "One" is executed and then the test to see if the value is "Two" and since it is not the block of code for the "else" (not equal to "Two" and "One" is not equal to "Two") is run and since that is the last set of code to be run its actions are what is displayed.

You need to use the "if ... then ... elseif ... then ...." structure to you script. This is called the "Nested if" statement. If you use JavaScirpt then you could use the 'switch()' statement.

George Kaiser