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

Adding Fields together to create local Counter

AlScott
Registered: Nov 2 2007
Posts: 123
Answered

I have a form where I want a field called COUNTCALL to increment by 1 each time a button called ADDNEW is pressed.

this is the script:

var NEWCALL = 1:
var ADDIT = 1;
{
COUNTCALL = raw.Value.NEWCALL + raw.Value.ADDIT + rawValue COUNTCALL+1;
this.rawValue = COUNTCALL;
}

And for the adding a new call is

xfa.sourceSet.HELPA.addNew()

Now the addNew() works perfectly, but the COUNTCALL isn't incrementing, and also it stops the addNew() function working when the above script is is activated by the appropriate button.

Remove the :
var NEWCALL = 1:
var ADDIT = 1;
{
COUNTCALL = raw.Value.NEWCALL + raw.Value.ADDIT + 1;
this.rawValue = COUNTCALL;
}

and all returns correctly.
I'm sure it's something simple. The project is running only one PC.
I've scoured through the forums but I can't seem to find another call describing this.

Many thanks
Al

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
If you define a variable (var sString = vlaue) you do not need to use any properties, it is a vaiable with a value and not an object. You also want to access the "COUNTCALL" filed and not the button ("this.rawValue).

Have you been reading the error messages?

Line 1 should end in a ";' not a ":".



var NEWCALL var NEWCALL = 1;var ADDIT = 1;COUNTCALL.rawValue = NEWCALL + ADDIT + COUNTCALL.rawValue + 1;

It looks like you are adding 3 to the call count and not one each time the button is pressed.

COUNTCALL.rawValue = COUNTCALL.rawValue + 1;
Will add 1 to the count call field.

George Kaiser

AlScott
Registered: Nov 2 2007
Posts: 123
Great - many thanks !!!!
I was getting myself confused with variable types!!!
thanks again
Ak