Actually Episerver 7 Xform Validation message is different from old versions, I found it by this path:
XPath : "/admin/editpropertydefinition/requiredcaption"
hopes some helpful to you.
http://cjsharp.com/blog/2013/04/30/list-of-xform-system-localization-keys-in-episerver-7/
I think it is not correct for required field validation.
Looking through the code it seems MVC uses a different message than web forms. MVC uses the path Martin mentioned ("/admin/editpropertydefinition/requiredcaption"). I'll report a bug for this since they should be the same and it's not recomended to override system messages. The temporary work around would be to override the system message until the bug has been fixed.
"/admin/editpropertydefinition/requiredcaption"
Hi Linus,
About Required ErrorMessage, it always use string.format to mix two element: errormessage + ("Title")
If we could use xml or other method to override it , I think that would have a higher configurability.
We then could only return "This field is required" message instead of that one which include brackets and title.
Thanks for the feedback Martin. Actually, for web forms have the behaviour suggested so I just made sure that it works in MVC as well. The solution is to get the translated resource for the key "/xform/requiredfield/summaryerrormessageformat". Then we do a String.Format and pass the title as the first parameter. This means that it's up to you to include or exclude the title in the message format, for instance:
"You need to fill in {0}"
or just
"Required field"
I reported and fixed the bug. For future reference, the bug is:
Hi,
I have read some topics on customising XForm validation messages using the language files; which have been very useful.
My problem arises when trying to customise the Required Value attribute of an XForm field. I have the following XML in my language resource:
My custom integer message appears correctly but my issue is with the Required Field message, which only ever displays the message:
Value must be entered ("")
I have checked the XPath for the override and it matches that returned by the Localization Service as the default message, though the default message itself isn't returned even if I don't specify one.
I've searched my solution for similar strings to the error message shown and can find nothing. I am fresh out of ideas what could be causing this behaviour so any suggestions are welcome!
Cheers