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

If else statement and drop down box

paulaeddy
Registered: May 14 2010
Posts: 22
Answered

I have a drop down box with the following options:
Select Filing Status
Single
Joint

I need to create a calculation based on the answer chosen in the drop down box. What I have so far is not working. If Single is chosen, the result needs to be Text3 + 15. If Joint is chosen, the result needs to be Text3 + 30.

var a = this.getField("ComboBox3").value;
var b = this.getField("Text3").value;
if(a = "Single")
{
event.value = b + 15;
}
else
{
event.value = b + 30;
}

My Product Information:
Acrobat Standard 9.3.1, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The comparative opeartor in JavaScript is '=='. '=' is the set operator in JavaScript.

George Kaiser

paulaeddy
Registered: May 14 2010
Posts: 22
I made the change:

var a = this.getField("ComboBox3").value;
var b = this.getField("Text3").value;
if(a == "Single")
{
event.value = b + 15;
}
else
{
event.value = b + 30;
}

This works!
paulaeddy
Registered: May 14 2010
Posts: 22
I took out "Select Filing Status" as a choice and it is now working. Thanks.!