This topic is locked
[SOLVED]

 Trying to get a condition to work

4/9/2018 2:42:03 AM
PHPRunner General questions
S
swanside author

Guys, I am trying to get this to work, and it does apart from the Invoice is getting calculated whether the ctrlSend_To_Invoice checkbox it checked or not, In otherwords, I need the checkbox called Send_To_Invoice to be checked for the Invoice field to get the value.

Going a step further, If the Invoice checkbox is deselected I need the invoice to go back to blank or 0.,

I will continue to google in the meantime.

Thanks

var ctrlPaying_Rate = Runner.getControl(pageid, 'Paying_Rate');

var ctrlInvoice = Runner.getControl(pageid, 'Invoice');

var ctrlSend_To_Invoice = Runner.getControl(pageid, 'Send_To_Invoice');

function func() {

ctrlInvoice.setValue((ctrlWorking_Hrs.getValue()) * (ctrlPaying_Rate.getValue()));

};

ctrlPaying_Rate.on('keyup', func);

ctrlWorking_Hrs.on('keyup', func);

//The Checkbox for the Send_To_Invoice NEEDS to be checked.

ctrlSend_To_Invoice.on('keyup', func);




woodey2002 4/9/2018

ctrlSend_To_Invoice.on('change', function(e) {
if (this.getValue()=='on'){
Full Example here-

http://asprunner.com/forums/topic/25091-hide-field-based-on-value-of-checkbox/
Cheers

James

S
swanside author 4/9/2018

Thanks James.

Got it to work using this. But the checkbox has to be selected before any thing else is inputted

Cheers

Paul

var ctrlPaying_Rate = Runner.getControl(pageid, 'Paying_Rate');

var ctrlInvoice = Runner.getControl(pageid, 'Invoice');

var ctrlWorking_Hours = Runner.getControl(pageid, 'Working_Hours');

var ctrlSend_To_Invoice = Runner.getControl(pageid, 'Send_To_Invoice');
ctrlSend_To_Invoice.on('change', function(e) {

if (this.getValue()=='on'){
function func() {

ctrlInvoice.setValue((ctrlWorking_Hours.getValue()) * (ctrlPaying_Rate.getValue()));}}

ctrlPaying_Rate.on('keyup', func);

ctrlWorking_Hours.on('keyup', func);
}
)