0

Thanks for taking the time to help out.

I'm using ASP.NET WebForms and I need a build a custom control for a custom CMS. I've implemented the server-side validation already. What it does is it check whether the values of the required fields are different than null and if they are not it shows a label which states that the field is required.

Now I'd like to implement a jQuery validation (I was instructed not to use the built in validation asp.net controls) and want to show the same labels if some condition is not fulfilled (like if the value of a required textfield is null).

I have very minimal knowledge in jQuery but I'm a fast learner. Could you give me some pointers and directions as to where to start. Thank you very much!


My question has been answered. If you are looking for an answer to my question, just read through the comments bellow. Big thanks to the community!

Dragan
  • 182
  • 1
  • 1
  • 10

3 Answers3

1

There is an Excellent jQuery Validation plugin. bassistance has a nice article, and StackOverflow is filled with jQuery validation questions.

To get you started:

Community
  • 1
  • 1
Konerak
  • 39,272
  • 12
  • 98
  • 118
  • Yea i did have a look at the jQuery Validation plugin but I can't seem to grasp it. It is not as intuitive as the documentation would make it seem :) I was thinking of maybe writing my own script. – Dragan Jun 19 '11 at 17:28
  • I would advise against writing your own... the plugin indeed has a bit of a learning curve, but on your next project/client/employer you'll be able to reuse it and work faster and better. There's lots of blogs, tutorials and even StackOverflow questions that can help you get started or solve specific problems. – Konerak Jun 19 '11 at 17:30
  • Thank you very much Konerak. I'll get to it right away. Thanks again! – Dragan Jun 19 '11 at 17:33
  • @John I added some example questions to show what (and how) you can do certain stuff, but if you run into problems yourself, feel free to just post a new question. We're pretty jQuery-minded here at StackOverflow :) – Konerak Jun 19 '11 at 17:34
  • Konerak, just a quick q, where do I define the labels which will show the error message? Cuz I would like to show the same label which i'm calling from server side code you know? – Dragan Jun 19 '11 at 17:44
  • No q's in comments, otherwise they don't benefit the other viewers of the site ;) But check the example of [RememberTheMilk](http://jquery.bassistance.de/validate/demo/milk/) – Konerak Jun 19 '11 at 18:16
0

the standard way of doing validation in jQuery is the validation plugin.
it has very good documentation as well.

J. Ed
  • 6,692
  • 4
  • 39
  • 55
0

Try this:

http://codebetter.com/karlseguin/2009/04/28/validation-part-2-client-side/

ilivewithian
  • 19,476
  • 19
  • 103
  • 165