RawMVC
RawMVC

Reputation: 123

ASP.NET MVC: input-validation-valid applied style not working

I found this article and I know its for webpages and not for MVC. My question or problem is the following. If a user provides the correct input for a textbox, I want to change its background-color to green, I did it with red for errors, that works. But the example shown in this article does not seem to work in my application and I did not find another example that made it work. So here is my CSS-Style that I tried to apply:

ErrorAndValidationHighlighting.css:

 .input-validation-error {background-color: #ffb3b3;}
 .input-validation-valid {background-color: #6BEF66;}

The TextBoxes in my view all look like this:

@Html.TextBoxFor(m => m.AdditionalComment)

As I said above, it works for the errors like it should, background-color changes to red and is displayed, but for valid input it does not work at the moment, so maybe you guys see what mistake Im doing or what is missing to make this work. Thanks in advance.

Upvotes: 0

Views: 1112

Answers (1)

Please apply this code and check the result

@Html.TextBoxFor(m => m.AdditionalComment,new  {@class="input-validation-valid"})

Upvotes: 0

Related Questions