Hello all
I'd like to show textbox values of fees into a sum total textbox. So far, I've been able to write a Load JS that adds all the textbox info into the sum total box correctly.
But how do I embed a checkbox value (id = ('second_judge_none'), value=30) into the sum? Preferably, it should be checked by default and show the value of '30' in the sum total box upon form loading. Consequently, it should subtract 30 once checkbox is unchecked. Would I need a separate 'Load JS' or can I put it into one code? And if yes, what would it look like and where do I add it? Please note that both events target the same sum total textbox.
I have NO CLUE about JavaScript whatsoever, I've just been copying and pasting this straightforward code 😀 , but adding the checkbox to it beats me. Any help would be much appreciated.
Thank you!
Chris
I'd like to show textbox values of fees into a sum total textbox. So far, I've been able to write a Load JS that adds all the textbox info into the sum total box correctly.
window.addEvent('domready', function() {
$('number_180').addEvent('change', rekenen1);
$('number_40').addEvent('change', rekenen1);
$('local_judges_25').addEvent('change', rekenen1);
$('number_0').addEvent('change', rekenen1);
$('number_20').addEvent('change', rekenen1);
$('extra_nights').addEvent('change', rekenen1);
});
function rekenen1(){
$('Total').value = $('number_180').value * 180 + $('number_40').value * 40 + $('number_20').value * 20 + $('local_judges_25').value * 25 + $('number_0').value * 0 + $('extra_nights').value * 20;
}
But how do I embed a checkbox value (id = ('second_judge_none'), value=30) into the sum? Preferably, it should be checked by default and show the value of '30' in the sum total box upon form loading. Consequently, it should subtract 30 once checkbox is unchecked. Would I need a separate 'Load JS' or can I put it into one code? And if yes, what would it look like and where do I add it? Please note that both events target the same sum total textbox.
I have NO CLUE about JavaScript whatsoever, I've just been copying and pasting this straightforward code 😀 , but adding the checkbox to it beats me. Any help would be much appreciated.
Thank you!
Chris
This topic is locked and no more replies can be posted.