Search code examples
asp.netrequiredfieldvalidator

RequiredFieldValidator have to click twice


I have run into the same problem as described here.

Only the question is marked as answered with only an explanation as to why you may have to click twice when using a RequiredFieldValidator on input fields - once as the blur of a textbox(for example) will correct the validation and then again to actually post the form.

I don't want to have to click a button twice! Does anyone know a solution or workaround to this?


Solution

  • Apologies for not posting code previously I assumed this to be a standard problem with the RequiredFieldValidator, but have since realised my particular problem was coming from a CompareValidator, used to ensure entered passwords matched.

    The CompareValidator was causing the issue that I described, causing me to have to click away from the field to blur and validate, before being able to click on the post button.

    I'm not sure why but changing the Display of the CompareValidator from Dynamic to Static has cleared the problem up.