Validation and popup window question

Discussion in 'ASP .Net' started by JJ297, Feb 27, 2008.

  1. JJ297

    JJ297 Guest

    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?
     
    JJ297, Feb 27, 2008
    #1
    1. Advertising

  2. JJ297

    bruce barker Guest

    the validation call is added to the onclick event also, but comes after your
    call (but your return prevents the validation call). you can call the
    validation logic yourself, or attach you code to the onsubmit event, which is
    only called after validation. (RegisterOnSubmitStatement).

    though it seems pretty bush to popup an alert that the user pressed the save
    button. confirmation on the response page that it was actually saved seems
    better (and not an alert).


    -- bruce (sqlwork.com)


    "JJ297" wrote:

    > 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?
    >
     
    bruce barker, Feb 27, 2008
    #2
    1. Advertising

  3. JJ297

    JJ297 Guest

    On Feb 27, 11:29 am, bruce barker
    <> wrote:
    > the validation call is added to the onclick event also, but comes after your
    > call (but your return prevents the validation call). you can call the
    > validation logic yourself, or attach you code to the onsubmit event, which is
    > only called after validation. (RegisterOnSubmitStatement).
    >
    > though it seems pretty bush to popup an alert that the user pressed the save
    > button. confirmation on the response page that it was actually saved seems
    > better (and not an alert).
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > "JJ297" wrote:
    > > 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?- Hide quoted text -

    >
    > - Show quoted text -


    I had a label on the page telling the user the page was submitted but
    the user insteads wants a pop-up window.

    How do I set my page up to use RegisterOnSubmitStatement?
     
    JJ297, Feb 27, 2008
    #3
  4. JJ297

    JJ297 Guest

    On Feb 27, 12:07 pm, JJ297 <> wrote:
    > On Feb 27, 11:29 am, bruce barker
    >
    >
    >
    >
    >
    > <> wrote:
    > > the validation call is added to the onclick event also, but comes after your
    > > call (but your return prevents the validation call). you can call the
    > > validation logic yourself, or attach you code to the onsubmit event, which is
    > > only called after validation. (RegisterOnSubmitStatement).

    >
    > > though it seems pretty bush to popup an alert that the user pressed the save
    > > button. confirmation on the response page that it was actually saved seems
    > > better (and not an alert).

    >
    > > -- bruce (sqlwork.com)

    >
    > > "JJ297" wrote:
    > > > 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?- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > I had a label on the page telling the user the page was submitted but
    > the user insteads wants a pop-up window.
    >
    > How do I set my page up to use RegisterOnSubmitStatement?- Hide quoted text -
    >
    > - Show quoted text -


    I got this to work:

    Page.ClientScript.RegisterStartupScript(Me.GetType(), "clientScript",
    "window.alert('Your entry was submitted');", True)

    How do I add window.location.href to this script to go to another page?
     
    JJ297, Feb 27, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9obiBXYWxrZXI=?=

    Popup Window Popup Timing

    =?Utf-8?B?Sm9obiBXYWxrZXI=?=, Nov 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    879
    =?Utf-8?B?Sm9obiBXYWxrZXI=?=
    Nov 4, 2005
  2. Matt Jensen
    Replies:
    1
    Views:
    5,262
    Matt Jensen
    Dec 16, 2005
  3. Blue®
    Replies:
    4
    Views:
    884
    Blue®
    Sep 27, 2003
  4. Jens Peter Hansen
    Replies:
    7
    Views:
    578
    Randy Webb
    Jun 19, 2004
  5. Raffi
    Replies:
    4
    Views:
    248
    Dr John Stockton
    Aug 12, 2004
Loading...

Share This Page