This project is read-only.

How to make a projection from submissions in a custom form?

Topics: General
Oct 14, 2012 at 3:50 PM

I have several submissions for a custom form I created.

I create a new filter and for the Filter I opt for the Message content Field of the custom form. However in the preview it shows nothing.

What should I be doing if I want to show on one page an overview of all the submitted content?

Oct 15, 2012 at 10:33 PM

I would like to help, can you inform me a bit more? Here is what I think you are saying, you have created a Custom Content Type and exposed it through the Custom Forms module for a user to fill in. Many users have done this and now you want to see a projection of these submissions. First things first, you can see the submissions by going to going "Forms" --> and clicking on "Submissions" next to the form type you find interesting.  Likely you know that and want something more powerful with Projections. If so, all you need to do is create the query to expose your "Custom Content Type", not the actual orchard forms content type.  Also, you don't filter on the actual field, you need to filter using "Content Types".  Once you select this and choose the custom content type you are exposing via Orchard Custom Formst I trust you will see everything works out.

Let me know.

Oct 18, 2012 at 6:28 PM

I can see indeed the submissions. What I'm trying is this:

create new query > new filter. I select as Content type: Contact form (the name I gave to the custom form). When I preview that I don't get anything back.

Oct 19, 2012 at 9:41 AM

Still not working. Any insight on this one?

Oct 19, 2012 at 11:31 AM

When you set up your Custom Form for display, either as a Page or as a Widget, are you checking the box that says to "Save the content item once the form is submitted"? I am sure you are based on what you said about being able to see the submissions.

Well, here is the good news, I cannot see the submissions either - fascinating. I am checking in the code to see why not.  Actually, I just figured it out looking at the submission log, if you view the "submission" log, you will see there is the option to "publish" the form submission. In short, the custom form is saving the content (I am guessing) as a draft, not as a published version. There might be a reason for this though.

Anyway, if you want to change this, you can modify the wrapper that makes this work: Parts.CustomForm.Wrapper.cshtml. The important part is the "button", change the name to "submit.Publish" and the value to "submit.Publish". After doing this all of your custom forms will be queriable (going forward of course).  Again, I am not sure of the motivation in that design, the actual controller has it set up to handle both "Save" and "Publish" which is why you just need to change the view.  Here is the complete code for that wrapper:

@using Orchard.ContentManagement;

    ContentItem customForm = Model.ContentItem;
    string returnUrl = Model.ReturnUrl;

    // remove default Save/Publish buttons

@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.Publish" value="submit.Publish">@T("Submit")</button>
Oct 20, 2012 at 1:20 PM

Thanks! Publishing the submissions worked out for me.