Results 1 to 3 of 3

Thread: Add a msgbox if condition is true

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Question Add a msgbox if condition is true

    When the user clicks the submit button, I run a function that validates the fields. The page will not submit unless the conditions are met. I want to know how to add a msg box if all the conditions are met....

    <form id=Frm name=Frm method="POST" action="Page2.asp" onsubmit="Valid()">


    <script language="Javascript">
    function Valid()
    {
    if (Frm.txtName.value == "")
    {
    alert("Enter Name!");
    Frm.txtName.focus();
    event.returnValue = false
    }
    }

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    What do you mean by a message box, at first I thought you meant an alert(), but I see you know how to use them.
    Have I helped you? Please Rate my posts.

  3. #3
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    just FYI, I would only alert the user if something is wrong. If everything is ok, the page should just submit to a thank you page or something similar. (This would be more easily implemented in PHP, mind you.)
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

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