I'm developing a web application. At first I use validation control to do required field validation, later I need to add some custom function to do the validation but still need required field validation. The problem is I found after I add onclientcliek event of the submit 开发者_开发问答button, the previous validation control does not fired. Is there a way that could let both the validation control and my javascript function work before submit the form? Thank you for your time.
Use CustomValidator Control. It is pretty easy to configure your own Client-side Validation. More info and an example here. Both validation controls can then work side by side.
make sure you have an ID on your submit button and try and put something like this in your document.ready function:
$("#YourSubmitButtonId").click(function(){
yourValidationFunction();
return false;
});
精彩评论