PDA

View Full Version : reset form please help



nick120
06-15-2005, 02:10 PM
i just need to reset the form and i cant figure out the code for it

function Check_Data() {
if(document.NICK.totalfield==0)
{
alert("please go back and hit calculate total");

}
if(document.NICK.totalfield>0)
{
alert("Thank you for your purchase");

}
}

once the alert pops up im supposed to refresh the page after the alert pops up can u help me please?

jscheuer1
06-15-2005, 07:44 PM
I'm assuming NICK is the name of the form and that you don't want a reset after the first alert in the code, if so, try:
function Check_Data() {
if(document.NICK.totalfield==0)
{
alert("please go back and hit calculate total");

}
if(document.NICK.totalfield>0)
{
alert("Thank you for your purchase");
document.NICK.reset();
}
}

nick120
06-15-2005, 10:34 PM
thank you so much lol

nick120
06-15-2005, 10:40 PM
alright um just one more thing if u dont mind lol this is my calc total function
just wondering if their is anything wrong with this it declares a total field a variable -- x and makes that field 500 then its supposed to take the info out of other radio buttons and if they are checked it should add that price to the total field adds up by clicking on a calculate total button. do i need anythin else besides this function? for the calculate total to work?

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=500;
}

nick120
06-15-2005, 10:49 PM
do i need something like this after the body

<FORM NAME=NICK onSubmit="Check_Data();">