I'm building a bi-lingual site, and I'm having trouble with the validation-messages.
I used to do this in my model:
[Required(ErrorMessage = "This field is required")]
public string Name { get; set; }
But now, I want to display an errormessage depending on the current culture.
Is there a nice solution to this? I've tried replacing the errormessage with a variable or getting it directly from the umbraco dictionary, but that doesn't work. It needs to be a constant expression.
Is there a way to bypass this? Can I make an errormessage which is a dictionary-alias? So I can display an error like:
But is there still a way to make the display-name and errormessage in the model variable? It would be a lot less work :)
Also, this method doesn't make a difference between a Required validation-error or a Emailaddress validation error :(
Formvalidationmessages from Dictionary
Hi there,
I'm building a bi-lingual site, and I'm having trouble with the validation-messages.
I used to do this in my model:
But now, I want to display an errormessage depending on the current culture.
Is there a nice solution to this? I've tried replacing the errormessage with a variable or getting it directly from the umbraco dictionary, but that doesn't work. It needs to be a constant expression.
Is there a way to bypass this? Can I make an errormessage which is a dictionary-alias? So I can display an error like:
?
edit: So, I've noticed a can use:
To display a message per field.
But is there still a way to make the display-name and errormessage in the model variable? It would be a lot less work :) Also, this method doesn't make a difference between a Required validation-error or a Emailaddress validation error :(
You can use this package Umbraco Dictionary MetadataProvider, it's automatically bind model to dictionary values using naming convention.
is working on a reply...