Try our conversational search powered by Generative AI!

XForm change the XForm Message after Posting Data


By default after form post we get message "Form Posted" . How can we change this message?

Apr 19, 2013 11:15

Change in language files?

Apr 19, 2013 14:17

I have three different form and I want different Message for all three of them. I am not sure If I can get that from Language file. I get the text "Form Posted" on successfuly form submission.

Edited, Apr 19, 2013 16:46

You might be better off having a property on the page for the message, then just showing the message and hiding the XForm (if that's what you want to do) after the form is submitted. There's not a lot of support within the EPiServer XForms context to customize the error or success messages. You can control some of the text via language files, but obviously that won't work if you want it customized on a per-form basis.

Apr 19, 2013 18:28

Thanks Chris. I was thinking I could customise the message somewhere. But I could not find this "Form Posted" message in lang files.

Apr 19, 2013 18:40

Hi, Robert,

For EPi 7.5: the text is in you VPP Modules/CMS/Util/Views/Shared/DisplayTemplates/XForm.ascx.

For EPi 7.1: the text is in C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Application\Util\Views\Shared\DisplayTemplates.

What you could do, if you are using MVP is to override XForm in DisplayTemplates or you can render it differently on the page/block itself by including your own Html.BeginForm, etc, so instead of using Html.PropertyFor, you render the content of XForm.ascx slightly different:

<% if (ViewData["XFormActionResult"] is EPiServer.Web.Mvc.XForms.XFormSuccessActionResult) { %>
    <strong>Write your own success msg here</strong>
<% } else { %>
    <% using (Html.BeginXForm(Model, htmlAttributes: new { @class = "form xform" })) { %>
        <% if (Model != null){ %>
            <% foreach (HtmlFragment fragment in (IEnumerable<HtmlFragment>)ViewData["XFormFragments"] ?? Model.CreateHtmlFragments()) {%>
                <%: Html.Fragment(fragment)%>
            <% } 
           } %>
    <% } %>
<% } %>

Hope this helps!


Jun 04, 2014 11:23
Jun 04, 2014 11:35
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.