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

Getting an if statement to check two numeric fields for values then /

ndjustin20
Registered: Oct 7 2009
Posts: 21
Answered

i am trying to do this

if(HasValue(NumericField13) && HasValue(NumericField13))then
var rent = NumericField13.rawValue;
var sqft = NumericField27.rawValue;
NumericField28.rawValue = rent / sqft;
else
NumericField28.rawValue = "0";

I keep getting a parse error and it's becuase i am trying to check both fields for values though i'm not sure how else to do this as that's what I need the if statment to check.

Justin

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Double post.
Has already been answered here [url]http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=15128[/url]

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

ndjustin20
Registered: Oct 7 2009
Posts: 21
Not Answered yet as I am using javascript.....sorry for any confusion should've specified...


Ok......I am actually writing javascript and && is the "and" operator so I can't use "&" or "and" from what I have ever coded. The only reason I wrote it like that is I couldn't post the actual code as I hadn't posted enough times to use script apparently. I have hit number 10 now so I am posting the actual code I am using. Here is the actual code I am using in javascript:function figurePSF(){

if(HasValue(NumericField13) & (HasValue(NumericField27)){var rent = NumericField13.rawValue;
var sqft = NumericField27.rawValue;
NumericField28.rawValue = rent / sqft;
}else{
NumericField28.rawValue = "0";
}
}
}


I keep getting an invalid token error so I'm wondering if HasValue is a valid property in javascript or if this is acrobat specific and I have to use the calculate event and if so where is the calculate event for the ZField we'll say. Also, the Z field is just made up and that isn't my actual code it was just an example depicting what I am trying to do.


Justin