1

I am using this line to represent my models validation message:

@Html.ValidationMessageFor(Model => Model.Email, "")

It workds in the manner that when the attribute isn't valid, it's set to the proper error message. I want to extend this so it first shows a default message, then a success message if the attribute "Email" is valid.

So..

Default: Please enter your email here. !Valid: The email is not valid (working) Valid: Thanks, you'll receive an email after completing the registration.

Is there any way to add default & successful messages?

2
  • 1
    You would think it would come with this functionality out of the box. But it does not. You can create a helper function that will use jquery to validate the values. Commented Nov 8, 2012 at 17:38
  • Thanks, it's a pity that they haven't implemented support for this. Commented Dec 17, 2012 at 13:21

1 Answer 1

1

You can achieve this using jQuery, on mail input blur event trigger the validation and change the message.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.