Required field validator not validating

I've set the Control To Validate and it works flawlessly when there is no code inside the btn Submit Checkup_Click but if I try to put a code inside it, it will go forward and disregard the Required Field Validator.

which will make it not call the client side validation.

Googling that uncovered a bunch of blog posts about how Visual Studio adds that line to the web.config when upgrading web apps from 1.1 to 3.5.

The blog posts were mainly complaining about how that field interferes with .net's AJAX stuff, but I'm guessing it messes with the Java Script emitted for the Required Field Validator in a similar fashion.

Right now, the button does nothing, besides posting back if the page is valid.

We will change this by adding an onclick event to it: As you will notice, we check whether or not the page is valid, before we do anything.

For other Conditions like Dropdown index change, textbox value change and radio button selection change you can call its onchange, onblur, onclick respectively and After executing the required condition you can Enabled/Disabled the Required Field Validator.

The Required Field Validator is actually very simple, and yet very useful.

However, I enter an empty string and no validation occurs.The form is quite simple and there are no Causes Validation="false" attributes set.My controls look like: I created a brand new webform in the same project with just a single textbox, validator and submit button and it acts the same way. Is there a global or project-wide setting that would cause this behaviour? If I remove the line, my validation works the way I expected it to.I have a question about what could stop a Required Field Validator from preventing a postback.I began working on an older, but simple aspx form and my predecessor used manual, server-side form validation (checking to see if some form fields have a value and if not displaying an error message in a label).

Leave a Reply