Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Custom xForm error messages in MVC

Vote:
 

I'm having a form with two input components validated as required and email. 

When leaving both fields blank and submitting the form inline error messages are shown telling me that the first field is required and second one is not a valid email address. So far so good, but I would like manipulate these error messages and give them in different languages. How do I do that? Before my submit action is hit in my controller the ModelState propery is populated with the error messages. It's possible for me to change the messages already entered in the ModelsState property, but that seems like the wrong way to handle this.

Any ideas?

#65743
Feb 07, 2013 12:04
Vote:
 

Hi Tobias,

did you solve this?

#71045
May 08, 2013 8:55
Vote:
 

(Response to old question, but someone might find this handy)

 

Hi have a look at this blog post, it lists the "resource keys": http://cjsharp.com/blog/2013/04/30/list-of-xform-system-localization-keys-in-episerver-7/


and if you haven't noticed that the LAng folder is gone, read this one to know how to implement the xml based resources : http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/Localization/CustomLocalizationProvider.htm&vppRoot=/SdkDocuments//EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/

then you can simply have in you xml file something like this

 

    <xform>
      <datatypes>
        <email>
          <inlineerrormessage>Your customized invalid email format message</inlineerrormessage>
        </email>
      </datatypes>
    </xform>

    

#71074
Edited, May 08, 2013 13:13
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.