Hi !
i'm using 6.1 and i'm trying something based on this manual
http://xlinesoft.com/phprunner/docs/how_to_calculate_values_on_the_fly.htm
But my problem is a little bit different, i don't want to calculate something like: Field1 x Field2 = Field3
I have 3 fields in my ADD page
Status
Field1
Field2
and i would like the satusfield immediatly updated when i open the ADD page.
If Field1is filled with some data, i would like the Statusfield to be "10"
If Field2is filled with some data, i would like the Statusfield to be "20"
I know PHP, but not javascript...so i tried a few things which never worked.
var ctrlField1 = Runner.getControl(pageid, 'Field1');
var ctrlField2 = Runner.getControl(pageid, 'Field2');
var ctrlStatus = Runner.getControl(pageid, 'Status');
function func() {
ctrlStatus.setValue(i_dont_know_what_to_put_here);
};
Also i don't know what code to use to replace this part below, keyup should not be the correct event:
ctrlField1.on('keyup', func);
ctrlField2.on('keyup', func);
I'm wondering if Javascript onload is the correct way to do what i want...i can't see which event to use for this problem...
I read this : http://xlinesoft.com/phprunner/docs/control_object.htm but i'm still confused...
Thanks for helping me!
Edit:
i'm thinking too much....why waiting for an event ??? This should work !?
var ctrlField1 = Runner.getControl(pageid, 'Field1');
var ctrlField2 = Runner.getControl(pageid, 'Field2');
var ctrlStatus = Runner.getControl(pageid, 'Status');
if (ctrlField1.getvalue()!="") ctrlStatus.setValue(10);
if (ctrlField2.getvalue()!="") ctrlStatus.setValue(20);