Joomal 3.4.0
Chronoforms5 v5.0.8
Event Registration Payment.
User selects one of two options (member ($3) or non-member ($5)) and then enters the number of guests that will also attend. The totalDue is supposed to calculated and displayed (either as member "$ 3 * x = totalDue" or "$5 * x = totalDue) and then displayed in a text box. They are then re-directed to PayPal.
The scenario above works well ONLY for the FIRST item listed in the radio button array. Choosing the second option is ignored.
I've cobbled together some JS using bits and pieces from the forum. I suspect that I'm not handling the array as I should. Any suggestions?
Code placed in the Load Javascript (above HTML (Render Form)):
"guestNum" is the number of accompanying guests entered by user
"mbrType" is the selected radio button option
Chronoforms5 v5.0.8
Event Registration Payment.
User selects one of two options (member ($3) or non-member ($5)) and then enters the number of guests that will also attend. The totalDue is supposed to calculated and displayed (either as member "$ 3 * x = totalDue" or "$5 * x = totalDue) and then displayed in a text box. They are then re-directed to PayPal.
The scenario above works well ONLY for the FIRST item listed in the radio button array. Choosing the second option is ignored.
I've cobbled together some JS using bits and pieces from the forum. I suspect that I'm not handling the array as I should. Any suggestions?
Code placed in the Load Javascript (above HTML (Render Form)):
window.addEvent('domready', function() {
$('guestNum').addEvent('keyup', calc);
$('mbrType').addEvent('click', calc);
});
function calc() {
var price = $('mbrType').value;
var quantity = $('guestNum').value;
if ( price > 0 && quantity > 0 ) {
$('totalCost').value = price * quantity;
}
}
"guestNum" is the number of accompanying guests entered by user
"mbrType" is the selected radio button option