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

Form Formatting Question

nahpishtim
Registered: Oct 12 2009
Posts: 30

Okay I've been starting out small with custom scripts for formatting and calculations but I need a hand with this one I can't find an example of something like it to work with. I have a form field that is formatted to show nothing unless certain other fields read a specific thing or number. I need to make a if A, B, & C do not equal "this", "this", or "this" event.value = event.value + " ft" and will this work with words in the checked fields rather than just numbers? This is what I've been working with that sorta works but not quite so help would be appreciated.

if(this.getField("Base1").value != blue
{
event.value = ""
}
else
event.value = event.value + " ft."

if(event.value <= 0)
{
event.value = ""
}

My Product Information:
Acrobat Pro 8.1.3, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
If you want to access a string value you need to put the string between quotation marks. Numbers do not need to be in quotation marks unless you want them treated as strings.
if( this.getField("Base1").value .toLowerCase() != 'blue' ) {event.value = ""}  else {event.value = event.value + " ft."} f(event.value <= 0)   {event.value = ""}

George Kaiser

nahpishtim
Registered: Oct 12 2009
Posts: 30
Okay thanks I have it accepting that now. But when I put more than one != whatever it no longer works no matter what I have in the field. How do I make it know to check all three for several specific values?

Maybe a better way to do it would be if I had a script for

If A, B, or C == D, E or F
event.value = event.value + " ft."

else
event.value = ""