This topic is locked

javascript calculate on the fly not working?

9/28/2010 11:23:14 AM
PHPRunner General questions
Microe author

I have a table with four fields, Q1 Q2, Q3 and Total. All integers. Q1 control is a radio button, Q2 control is check box, Q3 is a direct entry control. Have the following code from the xLinesoft example:
// Place event code here.

// Use "Add Action" button to add code snippets.

var ctrlQ1 = Runner.getControl(pageid, 'Q1');

var ctrlQ2 = Runner.getControl(pageid, 'Q2');

var ctrlQ3 = Runner.getControl(pageid, 'Q3');

var crtlTotal = Runner.getControl(pageid, 'Total');
function func() {

ctrlTotal.setValue(parseFloat(ctrlQ1.getValue()) + parseFloat(ctrlQ2.getValue()) + parseFloat(ctrlQ3.getValue()));

};
ctrlQ1.on('click', func);

ctrlQ2.on('click', func);

ctrlQ3.on('keyup', func);
This is in both the Add page and Edit page: Javascript OnLoad event.
Total never updates. Am pulling my hair out why this doesn't work? Does the function need to be specifed some where in the HTML?

Sergey Kornilov admin 9/29/2010

Impossible to answer without seeing your app. I recommend to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.