I have an old pdf form, which is a simple javascript calculation.
var count = this.getField("field1")
var price = this.getField("field2")
if (count.value !=0)
event.value = (count.value * price.value)
else
event.value = ""
If the form is blank, the form does not show "0" in multiplication result field. How I could get to the same designer 7 version? This would be important information for me.
Great thanks for your answer.
Views
Replies
Total Likes
I have modified the code to work in the FormCalc..
In your code you are not checking for the null value in the field. I am substituting 0 to null.
To try this code, you need to place it in Calculcate event fot he field where you want the multiplication to be displayed. Change the langauge to FormCalc.
var count = field1.rawValue;
if(count == null) then
count = 0;
endif
var price = field2.rawValue;
if(price == null) then
price = 0;
endif
if(count ne 0) then
$.rawValue = count.value * price.value;
else
$.rawValue =0;
endif
Let me know if you have any issues..
Thanks
Srini
Views
Replies
Total Likes
Hello
Thank you for your reply.
I did not get script to work, because it got Adobe Designer 7.0 to stop working....Run time error. I also tried a newer program. LiveCycle designer LC reported error syntax error, line 4 What could be due to an error? I tried to investigate the matter itself, but I did not see anything.
Views
Replies
Total Likes
Did you place the script in the Calculate event of the NumericField? Did you select the FormCalc as the language?
There was a minor mistake from my code in the highlighted portion.. I do not need ".value" to get the value of the variable. Please try the below corrected code..
var count = field1.rawValue;
if(count == null) then
count = 0;
endif
var price = field2.rawValue;
if(price == null) then
price = 0;
endif
if(count ne 0) then
$.rawValue = count * price;
else
$.rawValue =0;
endif
If you still have issues, send me the file to LiveCycle9@gmail.com so I can have a look at it.. Please mention where the issue is..
Thanks
Srini
Views
Replies
Total Likes
Here is the corrected code..
You have used count and price as variables. I renamed them so that their names don't clash with the reserved words.
Place it in the Calculate event of the Total. Change the field types to Numeric instead of TextFields for all the three.
var intCount = field1.rawValue;
if(intCount eq NULL) then
intCount = 0;
endif
var intPrice = field2.rawValue;
if(intPrice eq NULL) then
intPrice = 0;
endif
if(intCount ne 0) then
$.rawValue = intCount * intPrice;
else
$.rawValue =0;
endif
Thanks
Srini
Hello
I got the form, after all, act. It was a mistake to copy the code by e-mail. Then became involved in the signs which do not fall there.
Big thanks to their help and hard work in a small problem.
Views
Replies
Total Likes