Hey, i have a a contact form which includes Radio buttons and checkboxes and then name+email etc all those fields. I have a problem sending the checked checkboxes value to email. Radio button value it is sending but for checkboxes its giving me error code
function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
}
// return fnd; // return option index of selection
// comment out next line if option index used in line above
return str;
}
function DisplayPrice(){
var sum = 0;
sum += Number(getRBtnName('part1')); // .split(','); ??? NOTHING TO SPLIT IN VALUE OF PART1 ???
for (var i=2; i<10; i++) {
var el = document.getElementById('part'+i);
if (el.checked) { sum += Number(el.value); } // ??? PART2..PART9 are CHECKBOX not RADIO ???
}
document.getElementById('totalSum').value=sum.toFixed(2)+" €";
}
DisplayPrice();
</script>
</body>
</html>
Yeah as you notice the checkboxes and radio buttons are calculating in JavaScript. Also can i send the email in UTF8 charset, because it is not displaying letters "äüõö" which are needed.
Any help is appricieted, thank you in advance,
Martin
Sorry for posting that fast, i got it to work, it is sending the selected values now, is it possible to change the value ( actually add a name to the value ) without messing up the calculating system ? Because if i added (<input type="checkbox" name="cbox[]" value="300" id="part9" onClick="DisplayPrice();">LED valot - 300.00 €<br>) to <input type="checkbox" name="cbox[]" value="300,ledvalot" id="part9" onClick="DisplayPrice();">LED valot - 300.00 €<br>
It messed up the calentar and it displayed NaN only
Also is it possible to send <input class="vahe2" type="text" id="totalSum" value="" size="25" readonly border="0"> to the email ? It is total value and i tried to add it like that
HTML
<input class="vahe2" name="summa" type="text" id="totalSum" value="" size="25" readonly border="0">
Bookmarks