This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi I'm using the built in membership provider with MVC3. I've added the AspnetUser entity to my Lightspeed model in the designer. Validate Presence is set to true for the UserName property of AspnetUser. The validation works fine but I want to modify the default validation error message for the field that gets shown in the validation summary. It currently displays as "UserName is required" but I'm using an email address as the user name so I want it to say something like "Email is required". I know I can use @Html.ValidationMessageFor(model => model.user.UserName, "Email is required") to specify the inline validation message but how do I specify the validation message for the validation summary? Thanks. |
|
|
You will want to specify a custom error message for the validation which you can set by selecting the validation, selecting the properties window and then editing its "Custom Error" property to supply the "Email is required" message. See http://www.mindscapehq.com/documentation/lightspeed/Creating-Domain-Models/Validation for some more details about this :)
|
|
|
Ahhh, thanks. |
|
|
Hi again. So I've added Lightspeed validation to the UserName property of the AspnetUser entity. Validate presence works as expected but Validate Email isn't working. ie. The UserName text input element doesn't get decorated with the required html attributes for validating the email address and the server validation doesn't validate email format either. Here's the code that gets generated by the LS designer:
Here's the input element that gets rendered:
I've tried removing the validation and then adding it again - no change. Any idea what the problem is here? Thanks. |
|
|
Is this for client side validation using DataAnnotation attributes? If so we don't automatically emit any markup for ValidateEmail as per: http://www.mindscapehq.com/documentation/lightspeed/Building-Web-Applications-/Building-ASPNET-MVC-Applications
|
|