PDA

View Full Version : can someone help me out??



nick120
06-14-2005, 09:37 PM
srry its so long

ok here is my problem i have a form that has a couple fields and each field has a money value radio buttons have sertain values and lists have other values

here is the form-- if u put this in the body u can see what it looks like.

<form action="" method="post" name="nick" id="nick">
<div align="center">
<p>&nbsp;</p>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="46%" height="24">Processor Speed </td>
<td width="54%"><input type="radio" name="radio1" value="radiobutton">
1000 Mhz
<input type="radio" name="radio1" value="125">
1800 Mhz add 125$</td>
</tr>
<tr>
<td height="24">Hard Drive</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Memory </td>
<td><select name="memory" size="1" id="memory">
<option selected>128 MB</option>
<option>256 MB add 80$</option>
<option>512 MB add 125$</option>
<option>1 GB add 175$</option>
<option>2 GB add 225$</option>
</select></td>
</tr>
<tr>
<td>Monitor</td>
<td><select name="monitor" size="1" id="monitor">
<option>15 Std </option>
<option>19 add $75</option>
<option>21 add $125</option>
<option selected>5 Flat add $200</option>
<option>17 Flat add $300</option>
</select></td>
</tr>
<tr>
<td height="24">Dvd</td>
<td><input name="radio2" type="radio" value="radiobutton">
Dvd/Rom
<input type="radio" name="radio2" value="100">Dvd/Rw add $100 </td>
</tr>
<tr>
<td>3.5 inch disk drive</td>
<td><input type="radio" name="radio3" value="50">
Add 50$</td>
</tr>
<tr>
<td height="28"> <input name="SumTotal" type="button" id="SumTotal" value="Calculate Total" onClick="calctotal()" ></td>
<td>
<input name="totalfield" type="text" id="totalfield" size="6"></td>
</tr>
<tr>
<td> <div align="left">
<input type="submit" name="Submit" value="Submit">
</div></td>
<td> <div align="left">
<input type="reset" name="Submit2" value="Reload">
</div></td>
</tr>
</table>
<p>&nbsp;</p>
</div>
</form>


basically i need to use those other 2 functions to make this form add the total of anything clicked on (radio button, lists) and on the calculate button its suppose to add 500 dollers as a base price (with no upgrades selected)
and if any upgrade is checked or clicked on in a list it is suppose to add it to the total field by pushing calculate total. then on the submit button it should have 2 options 1 if user makes no upgrade and no choice then it alerts them and says u have not made a choice and the page refreshes or 2 the user makes a choice and hits the calculate button and then the submit button and alert thank u for your purchase. thats what it should do but i cant figure out the problem

thank u in advance

here is the 2 functions

<SCRIPT>
function calctotal() {
var x=500;
if (document.nick.radio1[1].checked==true)
x=x+125;
if (document.nick.radio2[1].checked==true)x=x+100;
if (document.nick.radio3[1].checked==true)
x=x+50;
document.nick.totalfield.value=x;
}

function Check_Data() {
if(document.nick.radio1[1].checked==true)
if(document.nick.radio2[1].checked==true)
if(document.nick.radio3[1].checked==true) {
alert("Form Completed Successfully");
return true;
} else {
alert("You Have not made a upgraded selection do u wish to continue?");
return false;
}
}

</SCRIPT>