Is there a way to restrict a number field to a positive value?
For example; a-b=c where both a and b have to be positive numbers and c cannot be less than 0.
K
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
The script looks ok. I have used Javascript so in the script editor make sure that you have the language dropdown select JavaScript and not FormCalc.
Niall
Views
Replies
Total Likes
Hi,
You could test the result first and then set the value of ObjectC.
The following would be in the calculate event of ObjectC:
var vResult = ObjectA.rawValue - ObjectB.rawValue
if (vResult <= 0)
{
this.rawValue = "0"; //or = "Error" or whatever you want
}
else
{
this.rawValue = vResult;
}
Hope that helps,
Niall
Views
Replies
Total Likes
Hi Niall,
Thank you for your reply.
I tried this:
var
vResult = Qty1.rawValue - Qty2.rawValue
if
(vResult <= 0)
{
this.rawValue
= "0"; //or = "Error" or whatever you want
}
else
{
this.rawValue
= vResult;
}
and I am getting a script error on the first {
Qty1 and Qty2 are the field names for ObjectA and Object B.
K
Views
Replies
Total Likes
Hi,
The script looks ok. I have used Javascript so in the script editor make sure that you have the language dropdown select JavaScript and not FormCalc.
Niall
Views
Replies
Total Likes
Thank you, I should have caught that.
K
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies