egdotnet Posted June 24, 2004 Posted June 24, 2004 i'm trying to create a registration form on my asp.net page with a required field validator on one text box and some custom validators for a textbox, a calendar, & a drop down list. the custom validators work fine with the submit button, but when i add a "response.redirect" string at the bottom of the submit sub, only the required field validator works. does anybody know why & how to fix it? thanks, Eric Quote
Arch4ngel Posted June 25, 2004 Posted June 25, 2004 It's easy as hell (you'll soon realize). Being redirected... code execution is stoped. So... the validating is done ONLY AFTER the current procedure (when your code as completed execution). However... it's like you've made a break or something like this. Response.Redirect will cut your code right where he is. You'll have to move this code elsewhere or... look at the 2nd parameters... it ask you if you want to end interpretation or not... might work. But I would rater change your redirection to somewhere else. Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
egdotnet Posted June 25, 2004 Author Posted June 25, 2004 then what's the best way to do a regular registration form w/ validators, because it doesn't really help much if it can't take you to a new page so the user actually knows he registered successfully? Quote
Arch4ngel Posted June 25, 2004 Posted June 25, 2004 Tryed an event that is done after validation ? Quote "If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown "Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me "A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend. C# TO VB TRANSLATOR
egdotnet Posted June 25, 2004 Author Posted June 25, 2004 what i did was to create a boolean variable that becomes false if args.isvalid = false and true if args.isvalid = true. then for the submit button, i said that if all the variables are true, do..., otherwise it just validates. how does that sound? Quote
niros Posted June 25, 2004 Posted June 25, 2004 Hi, I've encountered the same problem. what I did in the end (and it works) was to use the old fashion VB validation. I just deleted all the validation components of .net and used the way that I used with ASP: <HEAD> <script language="vbscript"> function Form1_onSubmit() Form1_OnSubmit = False if document.Form1.username.value = "" then document.getElementById("UserNameErr").innerHTML = "Please enter user name" exit function end if Form1_OnSubmit = true end function </script> </HEAD> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.