EPiServer 7, XForm validation message

Vote:
 

Hi, i'm using EPiServer7 with webforms. 
How can I override the validation message in an XForm field.

#68076
Mar 15, 2013 15:13
Vote:
 

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

#68145
Mar 15, 2013 17:48
Vote:
 

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

#68176
Mar 18, 2013 13:52
Vote:
 

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().

#68199
Mar 18, 2013 17:30
Vote:
 

Thanks Chris, that worked!

#68228
Mar 19, 2013 12:03
Vote:
 

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.

#74489
Aug 29, 2013 12:46
Vote:
 

File name is XForm.xml and it's placed inside Resources -> LanguageFiles

#74490
Aug 29, 2013 12:46
Vote:
 

It was not the correct resource key, it should be:

    <admin>
      <editpropertydefinition>
        <requiredcaption>Fältet är obligatoriskt</requiredcaption>
      </editpropertydefinition>
    </admin>

    

#74491
Aug 29, 2013 13:17
Vote:
 

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?

#75563
Sep 30, 2013 12:17
Vote:
 

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.

#75572
Sep 30, 2013 15:06
Vote:
 

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.

#75573
Sep 30, 2013 15:08
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.