Wordpress Themes - Wordpress Themes - Computers 2007 - Payday Loans - Bad Credit Loans

PDA

View Full Version : Need help with total update using radio button & textbox


vistaf
Feb 13th 2007, 5:09 pm
I'm trying to make a form where it would automatically update the total based on the ticket they have chosen (radio button) & additional donation they want to give (textbox). The textbox I have no problem with but the radio button doesn't add. Can anyone please help? Thank you.


<html>
<head>
<SCRIPT language="javascript" type="text/javascript">
function updateTotal()
{

var ticket = 0;
for (i = 0; i < 7; i++){
if (document.forms["secureform"].test[i].checked == true){
ticket = '' + (document.forms["secureform"].test[i].value * 1));}

document.forms["secureform"].totalAmount.value = '' ((document.forms["secureform"].contribution.value * 1) + (ticket * 1)) ;
}
function updateFamilyTotal() {
document.forms["secureform"].contribution.value = 0
updateTotal();
}


//ends function
</SCRIPT>


</head>

<body>
<form method="POST" action="#cgi.script_name#" name="secureform">

<table>
<tr>
<td colspan =2> <input type="radio" name="ticket" value="10000" onClick="updateTotal()">Running the Race Table (10 Tickets) -$10,000<br>

<input type="radio" name="ticket" value="7500" onClick="updateTotal()">
American Hero Table (10 Tickets) -$7,500 <br>

<input type="radio" name="ticket" value="5000" onClick="updateTotal()">
Freedom Fighter (10 tickets) - $5,000<br>

<input type="radio" name="ticket" value="3500" onClick="updateTotal()">
Founding Father Table (10 tickets) -$3,500<br>

<input type="radio" name="ticket" value="2500" onClick="updateTotal()">
Patriot's Pride Table (10 tickets) -$2,500<br>

<input type="radio" name="ticket" value="800" onClick="updateTotal()">
Flag Bearer Table (2 tickets) -$800<br>

<input type="radio" name="ticket" value="250" onClick="updateTotal()">
Stars and Stripes: Individual tickets, $250 per person <br>
<br> </td> </tr>
<tr> <br>
<td align="CENTER" width="500">Additional Contribution<span class="colB font-size: 10pt;"><br>

<input type="Text" name="contribution" value="#contribution#" size="5" onChange="updateTotal();"><br>

<p>Total Contribution (contribution plus ticket prices): $ </p>
<input type="text" name="totalAmount" readonly="true" style="width:50px;">
</span></td> </tr>
<input type="submit" value="Submit"></td>
</table>

</form>
</body>