Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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.

"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

Posted
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?
Posted
Tryed an event that is done after validation ?

"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

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

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>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...