This project is read-only.

Orchard Custom Forms Custom message to display after form submission

Topics: Customizing Orchard
Jun 29, 2012 at 2:14 PM

Hi Guys

1.I created a form using the custom form but i use it as widget . But i'am not able to display the custom message after submission . I' can't find this message on my page ? does anybody have an idea ?

2.I also want to know why the textArea in the custom forms has validation in the server side which redirect to the  /orchard.customforms/Item/Create/137 to the item page and not the page containing the widget .Is there a way to convert this validation on the client side like the InputFields.


Jun 30, 2012 at 8:28 AM

Those features are not yet released so now is a good time to file bugs...

Jul 4, 2012 at 9:57 PM

Ok so now i managed to have the custom message after submission working a did a little debug and it seems that we are not rendering the message zone anywhere in the view so i added this line of code and it seems to be working now :


So here in the notification filter we can clearly see that the zone is added in the notifyfilter.cs  :

var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
            foreach(var messageEntry in messageEntries)
                messagesZone = messagesZone.Add(_shapeFactory.Message(messageEntry));

and then we just need to add this line @Display(Layout.Zones["Messages"]) to the view Parts.CustomForm.Wrapper.cshtml


@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Item", new { area = "Orchard.CustomForms", id = Model.ContentItem.Id }))) {

    // Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type

    @Html.Hidden("returnUrl", returnUrl);

    <fieldset class="submit-button">
        <button type="submit" name="submit.Save" value="submit.Save">@T("Submit")</button>

This should fix the first issue for those who have the same problem

Jul 4, 2012 at 10:06 PM

By the way i just realized that this is not a bug . I am using my own designed Theme and the layout i'am not displaying the message zone .

So if you have on your theme a message Zone you do not have to add the display zone to the view . Maybe i should fix my theme to display the message zone .