This topic is locked
[SOLVED]

 Javascript

12/9/2011 1:32:42 PM
PHPRunner General questions
author

I am very new to javascript. In PHP I can use $oldvalues && $newvalues. In Javascript I can call the new value by;
);
[color=#0000FF]var new = ctrlnew.getValue();
How can I get the old value so that i can do an equation like oldvalue-newvalue = 7
Thanks in advance

C
cgphp 12/10/2011
var ctrlTotal = Runner.getControl(pageid, 'total');

var old_value = ctrlTotal.getValue();
function func()

{

var new_value = ctrlTotal.getValue();
if(old_value - new_value == 7)

{

//execute your custom code

}

}
ctrlTotal.on('change',func);
7542 12/10/2011

Thanks that worked.
I had to add to ; to the end of the function func(). I am sure that was just a typo
var ctrlTotal = Runner.getControl(pageid, 'total');

var old_value = ctrlTotal.getValue();
function func()

{

var new_value = ctrlTotal.getValue();
if(old_value - new_value == 7)

{

//execute your custom code

}

};
ctrlTotal.on('change',func);