Results 1 to 5 of 5

Thread: Form clears after alert

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    Form clears after alert

    I have three buttons included in my form. I have a javascript onclick event for one of the submit buttons. Here is the javascript associated with the onclick event:

    function chkSave(){
    if(document.form1.txtjobnum.value == "")
    {
    window.alert("please enter a job number");
    document.form1.txtjobnum.focus();
    return false;
    }
    }

    The alert box works correctly but whenever I click on OK in the alert box my all the data in my form is cleared. Can anybody explain why this is happening?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Form clears after alert

    Any refreshing going on that isn't being shown?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    Re: Form clears after alert

    No refreshing. I thought return false was the solution but it doesn't work.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Form clears after alert

    If you click on Cancel on the Alert button, does the same thing happen?

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    779

    Re: Form clears after alert

    There is no choice for a cancel, there is just an OK button.

Posting Permissions

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



Click Here to Expand Forum to Full Width