Using a popup window

  • 13 years ago

    hi ,
    After a user clicks the submit button I want a window to come up
    telling them your entry has been submitted.

    I have this code in my page load section which works well.

    Submit.Attributes.Add("onclick", "return window.confirm('Your entry
    was submitted.')")

    My problem is it's not picking up my validation if the user doesn't
    fill in the text boxes and just hit the submit button they get your
    entry was submitted.  How do I get it to see the validation first and
    only submit the page after it's filled out or should I set up the popup window a different way? 

    After the user closes the popup window I want it to go to another page too.  Hope all makes senese.

    Thanks in advance
    Dilipv

  • 13 years ago

     Hi Dilipv,

    Here is the solution of your problem, i just wrote this code but not tested, you have to test your self.

    write this code under "Head" section.

    <script language="javascript">
        function vld()
        {
            if(document.form1.TextBox1.value == "")
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        function test()
        {
            if(vld())
            {
                return confirm("Entry was submitted");
            }
            else
            {  
                return false;
            }
        }
        function confirmVld()
        {
            if(test())
            {
                alert("Success");
                document.write("Your page will be redirected shortly....<meta http-equiv='refresh' content='1; url=http://www.yahoo.com' //>");
            }
            else
            {
                alert("Entry was not submitted");
                return false;
            }
        }
        </script>

    then add button attribute in your cs file like this.

    this.Button1.Attributes.Add("OnClick", "confirmVld()");

     

    Hope this will help you, feel free to ask any thing if u still feel some problem. 

  • 13 years ago

    hi hon33y ,
    First of all thanks for your support. Currently i have not tested your code but now i am going to test. Hopefully it works for me.
    Once again thanks for co-operation.

    Dilipv

  • 13 years ago
    any time dilip.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray