Results 1 to 5 of 5

Thread: Form clears after alert

  1. #1
    Fanatic Member
    Join Date
    Sep 02
    Posts
    756

    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
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    Re: Form clears after alert

    Any refreshing going on that isn't being shown?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    Fanatic Member
    Join Date
    Sep 02
    Posts
    756

    Re: Form clears after alert

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

  4. #4
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    Re: Form clears after alert

    If you click on Cancel on the Alert button, does the same thing happen?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  5. #5
    Fanatic Member
    Join Date
    Sep 02
    Posts
    756

    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
  •