Results 1 to 5 of 5

Thread: reset form please help

  1. #1
    Join Date
    Jun 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default reset form please help

    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?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:
    Code:
    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();
    } 
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thank you so much lol

  4. #4
    Join Date
    Jun 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

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

  5. #5
    Join Date
    Jun 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    do i need something like this after the body

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •