I haven´t tried this in EPiServer 7, but couldn´t you just hook into the BeforeSubmitPostedData event and do what you need there?
Frederik
I guess I can do that, but I was wondering if there was some sort of xml resource file (i can override) where these messages are stored
You can create your own language XML and override the default validation messages... though I don't know all of the available keys to override. I started looking into this, and I got something like this so far:
<?xml version="1.0" encoding="utf-8" ?>
<languages>
<language name="English" id="en-US">
<xform>
<datatypes>
<email>
<inlineerrormessage>
Custom email validation message!
</inlineerrormessage>
</email>
</datatypes>
</xform>
</language>
</languages>
You probably just need to find all of the possible datatypes and add a message for each. This worked for the field's inline validation message and the text in the validation summary.
I'd suggest either looking at the code using Reflector to find what you keys need, or looking through the output of LocalizationService.Current.GetAllStrings().
Hey guys, do you have a clue where I am making a mistake. I want to change the required field error for the XForm.
<languages>
<language name="English" id="en">
<edit>
<editform>
<requiredcaption>Field is required</requiredcaption>
</editform>
</edit>
</language>
<language name="Swedish" id="sv">
<edit>
<editform>
<requiredcaption>Fältet är obligatoriskt</requiredcaption>
</editform>
</edit>
</language>
</languages>
I have also tried to put en-US and sv-SE instead of en and sv for language id.
It was not the correct resource key, it should be:
<admin>
<editpropertydefinition>
<requiredcaption>Fältet är obligatoriskt</requiredcaption>
</editpropertydefinition>
</admin>
Hey guys, do you know if this should work in EPi6, too? I can't seem to do the same, have you tried this before?
While I have not tried it, I'm guessing it's completely different since the whole language handling got overhauled. Just looking at the 'languageEN.xml' in the 'lang' folder of a EPi6 site, it looks like the key to a similar message is '/xform/requiredfield/inlineerrormessage'. You can also find language keys for edit mode under the 'editxform' node.
Yeap, I've seen that the XPaths are the same. However, EPi doesn't seem to read those from lang folder. I'll let you know if we find a way other than overwriting this ourselves in BeforeSubmitPostedData.
Hi, i'm using EPiServer7 with webforms.
How can I override the validation message in an XForm field.