Hi,
I have got a form with a mixture of Radio Groups and Checkbox Groups. Currently I'm using the following code to add up the total of the Radio Groups:
<script>function calculateRadio(){
var op1=document.getElementsByName('form[CourseDates]');
var op2=document.getElementsByName('form[OxfordExperienceFee]');
var op3=document.getElementsByName('form[FootballCoachingFee]');
var op4=document.getElementsByName('form[TennisCoachingFee]');
var op5=document.getElementsByName('form[GolfLessonsFee]');
var op6=document.getElementsByName('form[PaintballFee]');
var op7=document.getElementsByName('form[KartingFee]');
var op8=document.getElementsByName('form[HorseRidingLessonsFee]');
var op9=document.getElementsByName('form[LondonMusicalFee]');
var op10=document.getElementsByName('form[HarryPotterTourFee]');
var op11=document.getElementsByName('form[DrivingExperienceFee]');
var op12=document.getElementsByName('form[4HoursEFLFee]');
var op13=document.getElementsByName('form[6HoursEFLFee]');
var op14=document.getElementsByName('form[OnetoOneExtraEFLFee]');
var op15=document.getElementsByName('form[ToAndFromFrewenFee]');
var op16=document.getElementsByName('form[ToAndFromEarlscliffeFee]');
var op17=document.getElementsByName('form[EconomyTransferFee]');
var result=document.getElementById('Total2');
result.value=0;
result.value=parseInt(result.value);
for(i=0;i<op1.length;i++)
if(op1[i].checked) result.value=parseInt(result.value)+parseInt(op1[i].value);
for(i=0;i<op2.length;i++)
if(op2[i].checked) result.value=parseInt(result.value)+parseInt(op2[i].value);
for(i=0;i<op3.length;i++)
if(op3[i].checked) result.value=parseInt(result.value)+parseInt(op3[i].value);
for(i=0;i<op4.length;i++)
if(op4[i].checked) result.value=parseInt(result.value)+parseInt(op4[i].value);
for(i=0;i<op5.length;i++)
if(op5[i].checked) result.value=parseInt(result.value)+parseInt(op5[i].value);
for(i=0;i<op6.length;i++)
if(op6[i].checked) result.value=parseInt(result.value)+parseInt(op6[i].value);
for(i=0;i<op7.length;i++)
if(op7[i].checked) result.value=parseInt(result.value)+parseInt(op7[i].value);
for(i=0;i<op8.length;i++)
if(op8[i].checked) result.value=parseInt(result.value)+parseInt(op8[i].value);
for(i=0;i<op9.length;i++)
if(op9[i].checked) result.value=parseInt(result.value)+parseInt(op9[i].value);
for(i=0;i<op10.length;i++)
if(op10[i].checked) result.value=parseInt(result.value)+parseInt(op10[i].value);
for(i=0;i<op11.length;i++)
if(op11[i].checked) result.value=parseInt(result.value)+parseInt(op11[i].value);
for(i=0;i<op12.length;i++)
if(op12[i].checked) result.value=parseInt(result.value)+parseInt(op12[i].value);
for(i=0;i<op13.length;i++)
if(op13[i].checked) result.value=parseInt(result.value)+parseInt(op13[i].value);
for(i=0;i<op14.length;i++)
if(op14[i].checked) result.value=parseInt(result.value)+parseInt(op14[i].value);
for(i=0;i<op15.length;i++)
if(op15[i].checked) result.value=parseInt(result.value)+parseInt(op15[i].value);
for(i=0;i<op16.length;i++)
if(op16[i].checked) result.value=parseInt(result.value)+parseInt(op16[i].value);
for(i=0;i<op17.length;i++)
if(op17[i].checked) result.value=parseInt(result.value)+parseInt(op17[i].value);}
</script>
This adds up the Radio Groups perfectly. However, there is a Checkbox Group field also, how can I include these values in the above calculation?
Many thanks