Validation and popup window question

J

JJ297

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?
 
B

bruce barker

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)
 
J

JJ297

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)








- 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?
 
J

JJ297

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top