Required Field Validators
-
Hello all , I have used Asp .Net Required field validators in my aspx site.The problem is like its firing the validation but after the server operation. Like suppose i m entering some new data and kept null validation.Its firing that validation after the data is saved in the database... Pls can any one help me..... thanks................ :-D
-
Hello all , I have used Asp .Net Required field validators in my aspx site.The problem is like its firing the validation but after the server operation. Like suppose i m entering some new data and kept null validation.Its firing that validation after the data is saved in the database... Pls can any one help me..... thanks................ :-D
Did you add the following code before your dbase operation? C#
if (page.isValid()) { // your dbase code }
VB.NETIf page.isValid() Then // your dbase code End if
Well I guess the code speaks for itself. Only if the data is valid (passed through the server side validation) it should do some action. Hope this helps. Gidon -
Hello all , I have used Asp .Net Required field validators in my aspx site.The problem is like its firing the validation but after the server operation. Like suppose i m entering some new data and kept null validation.Its firing that validation after the data is saved in the database... Pls can any one help me..... thanks................ :-D
Thanks.... Well i have the problem after i upload my site on server...do i need to deploy WebUIValidation.js, SmartNav.js files on my server in my site folder...if yes let me know the location.... Its working on my developement machine properly....without checking the validity of the page like VB. net page.IsValid() { } thanks once again..... do let me know if u come up some solution for this...... :-D
-
Thanks.... Well i have the problem after i upload my site on server...do i need to deploy WebUIValidation.js, SmartNav.js files on my server in my site folder...if yes let me know the location.... Its working on my developement machine properly....without checking the validity of the page like VB. net page.IsValid() { } thanks once again..... do let me know if u come up some solution for this...... :-D
If the website is well configured, those files should be there already. Otherwise you have to run the asp.net configuration command for that website (I forgot the details about that). As you know the WebUIValidation.JS file includes all the CLIENTSIDE validation scripts for your asp.net app. So if it is not found it won't be able to validate your page using client side scripting. But one important thing is that this client side validation doesn't work with browsers such as FireFox, ASP.NET falls back on Server side validation for these browsers. And for server side validation you need to provide the code I just gave you. (Check you dev site with Firefox for example and you'll see that you'll get exactly the same problem as with your live site). So plan of action: - Check your dev site with Firefox for example, and see that client validation doesn't work, and server validation is "skipped" (actually it is being executed, but your dbase code will also be executed). - Update your code so it will include
page.isValid()
before executing any code that depends on a valid form input. - Configure your live site, so that it includes the right client side script files And that's it. Gidon