I want to make a real time form validation in asp.net form in which when开发者_运维知识库 i lost focus a field it show an error or success of field entrance data
i search for best way to do that ..
jQuery Validator
is by far your best option
Before you go into best user experience in form validation you have to put some consideration while implementing it,
the validation must always be in the server side and never go only in client side validation in case the user disables javascript or he can change the validation expression using some tools, therefor there is two ways you do it.
ajax validation or multiple validation
in Ajax validation when the user focus out the item it directly posts the data to server validates it and then you put the UI and do validation on submit too.
or you make validation in javascript for the UI without AJAX and then you do other validation in server side on submit. it means you need to copy the validation expressions once in server and once in javascript.
after you decide which method you go then you find the most appropriate tool for it. and I recommend you to go with jQuery plugins they are very easy to use
ASP.NET Server Validation Controls in conjunction with ValidatorCallout from Ajax Control Toolkit is also a good option. It can do validations on both server and client end. Obviously it will require more effort than jQuery.
精彩评论