Question

I have a page with a number of RequiredFieldValidator controls validating text boxes. The validation message always appears and the validator does not function. The validation message remains visible whether or not the text box contains any text.

This is not happening locally but only on the remote servers. I am wondering if it is configuration issue, but I can't see anything obviously different in config that might cause it.

An example:

<asp:TextBox ID="Name" runat="server" CssClass="text full"></asp:TextBox>
<asp:RequiredFieldValidator ID="nameRequiredFieldValidator" runat="server" CssClass="requiredError" ControlToValidate="Name" Display="Dynamic" />

All other validation on the page is working correctly, it is just the RequiredFieldValidators that are the problem.

There are no JS errors and no files appear to be missing or failing to load. I have verified this through Fiddler and browsers.

I have the same issue in all browsers that I have tried.

Any suggestions would be most welcome. Thanks.

Was it helpful?

Solution

The problem here was that a CSS rule, recently applied, was overriding the in-line asp.net in-line styles. This meant that validation was in fact working correctly, but as the in-line style="display: none" was overridden, the validation messages were constantly showing.

This only affected required field validators as these had a different CSS class applied to other validators. Another entirely unrelated issue with a URL rewriter specific to the site was preventing the form from submitting, which confused the issue further. Thanks for your help, anyway.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top