This topic is locked

Javascript onLoad event

12/6/2010 4:57:33 AM
PHPRunner General questions
E
ellesse author

Hi,
I've used this code from phprunner help in inline add record (Javascript onLoad event):



var ctrlPrice = Runner.getControl(pageid, 'PREZZOUN');
var ctrlQuantity = Runner.getControl(pageid, 'QUANTITA');
var ctrlTotal = Runner.getControl(pageid, 'PREZZOTOT');
function func() {
alert(ctrlPrice.getValue());
if ( ctrlPrice.getValue()!='' && ctrlQuantity.getValue() && !isNaN(ctrlPrice.getValue()) && !isNaN(ctrlQuantity.getValue()))
ctrlTotal.setValue(parseFloat(ctrlPrice.getValue()) * parseFloat(ctrlQuantity.getValue()));
else
ctrlTotal.setValue('');
};
ctrlPrice.on('keyup', func);
ctrlQuantity.on('keyup', func);


but this code does not work.
Someone help me? Thank you.
Leonardo Santoro

Admin 12/6/2010

Probably field name is misspelled or there is something else that prevents it from working.
I recommend 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.

E
ellesse author 12/6/2010

In inline add (Javascript load function) how I use the field name with the exact row id?

Admin 12/6/2010

Sorry, I don't understand your last question.

E
ellesse author 12/6/2010

Sorry for my bad english.
Look this code in Javascript onload event (from phprunner help - to calculate total value on the fly not modified ):
var ctrlPrice = Runner.getControl(pageid, 'Price');
var ctrlQuantity = Runner.getControl(pageid, 'Quantity');
var ctrlTotal = Runner.getControl(pageid, 'Total');
function func() {
if ( ctrlPrice.getValue()!='' && ctrlQuantity.getValue() && !isNaN(ctrlPrice.getValue()) && !isNaN(ctrlQuantity.getValue()))
ctrlTotal.setValue(parseFloat(ctrlPrice.getValue()) parseFloat(ctrlQuantity.getValue()));
else
ctrlTotal.setValue('');
};
ctrlPrice.on('keyup', func);
ctrlQuantity.on('keyup', func);
I have a table with the same fields Price, Quantity and Total like sample.
When I use add page in "Pages" tab, the field Total is updated with Price
Quantity, but when I use inline add for the same fields, the field Total is not updated.
Thank you.
Leonardo Santoro

Admin 12/6/2010

Leonardo,
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.