Andi03 Posted September 21, 2003 Posted September 21, 2003 Hi. I have a field in my form that I want to check if its content already exsits in my database. Im using a custom validation control for this. I have a function that returns true or false (Custom_Ver). And I have made a sub like this: Sub Field_Ver(source As Object, args As ServerValidateEventArgs) If MyFunction() Then args.IsValid = False Else args.IsValid =True End If End Sub 1. When I have set the Client Validation Function to my Field_Ver function. The brower always fires the validation when ever I enter some thing in the text box. And returns that the content of the textbox is not valid. But this always happens. What ever I enter it fires. I have put in a Response.Write that displays what my function ( Custom_Ver ) returns and it returns false but still the validation control fires. Why? 2. If I have set the OnServervalidation to my Custom_Ver function, it wont fire if I have code in that runs when I push my send button. If I leave that sub that gonna run when I click on send, then the validation control works. Promts when the value exsist and not promting when the value does not exsist. But if I have code in my sub that gonna run when I push the button, then the validator does not work. It just fires the click sub and doesn't check the value in the text box. Why is that? The click sub updates stuff in my database by the way. Can someone help me with one of the two probs or both??? //Andi Quote
Muhad Posted December 13, 2003 Posted December 13, 2003 I can only guess here but maybe you could Disable the validator control until it is necessary to use it; then Enable it. Quote
Administrators PlausiblyDamp Posted December 13, 2003 Administrators Posted December 13, 2003 The client validation function should be a client side script (javascript, vbscript etc.). For the code in the OnServerValidation to fire then all the client side validators must approve the data - otherwise they block the post back. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.