Try our conversational search powered by Generative AI!

XForm Required Field Validation Message



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:

      <requirelogon>You need to be logged in</requirelogon>
        <inlineerrormessage>Required Field</inlineerrormessage>
          <inlineerrormessage>Not a valid integer</inlineerrormessage>


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!


May 29, 2013 17:58

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.

Aug 14, 2013 5:35

I think it is not correct for required field validation.

Aug 14, 2013 5:37

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.


Aug 14, 2013 8:32

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.

Aug 14, 2013 8:41

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"

Aug 14, 2013 9:33

So please report a bug and thanks, Linus.

Aug 14, 2013 9:48

I reported and fixed the bug. For future reference, the bug is:

Bug #104343: MVC XForm validation uses a system localization message which should not be overridden by partners
Aug 14, 2013 11:12
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.