Welcome to WebmasterWorld Guest from 54.227.101.214

Forum Moderators: ocean10000

Message Too Old, No Replies

ASP.Net Field Validation

Want it done client side

     

RossWal

10:19 pm on Aug 14, 2002 (gmt 0)

10+ Year Member



I'm just getting started learning asp.net. One of the first things I've noticed is that some of the cool stuff it does happens server side rather than client side. Like if you disable a control in an on-click event, or when you use the required field editing control. Though I'm a ways away from doing this, I'm wondering if it would be feasible to write a custom control that would write some javascript to the client for field editing. The trick would be tying that code to the change (or whatever) event on the control to be edited.

Has anyone done any thinking on this? Are there any good 3rd party controls I should look at?

Thanks for any input.

PS It apears this board tends to be somewhat advanced and doesn't have a ton of traffic. Having said that it would seem that a bunch of newbie questions could quickly become somewhat of an annoyance. Is there a more appropriate forum elsewhere for someone trying to teach themselves asp.net?

Thanks again!

Xoc

9:22 am on Aug 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Newbie questions are very, very welcome here! Ask away.

There actually already are some custom controls for doing field level validation. They do client-side validation if the client has javascript turned on, but also always do server-side validation, so there is no way to bypass the validation by browser settings or hacking. They are really cool. I haven't really played with them except demo code, but take a look at the Required Field Validator, Compare Validator, Range Validator, Regular Expression Validator, and Custom Validator controls.

RossWal

4:15 pm on Aug 15, 2002 (gmt 0)

10+ Year Member



Thanks Xoc. I don't know what I was thinking.... I though sure I had checked and there was no client side validation on the required field edit. I rechecked, and sure enough it's there. Must have been dreaming....back to sleep time ;)

andrey_sea

4:52 pm on Aug 15, 2002 (gmt 0)

10+ Year Member



Greg,

I am using Required Field Validator and Range Validator controls, but the way they work is they do a javascript document.write() thing to generate text on the page before posting back to the server. The question is where do you place these controls so that user doesn't become confused? See my form is rather long and it must be that way. So there is some vertical scrolling, so if I put a validation control next to the field at the top user will not see that there is a problem and will keep hitting submit button to no avail. If I place all of the error messages near submit button the users will get irritated about scrolling up. What would you do? Is there a way to make these web form controls pop up error message boxes of the alert() type?

Thanks!

andrey_sea

7:48 pm on Aug 15, 2002 (gmt 0)

10+ Year Member



Never mind my previous post, I have this problem solved using * in Text property and error text in ErrorMessage property of validation controls. Combined with validationsummary control it works great!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month