Custom form title part placement not working

Topics: Customizing Orchard, General, Writing modules
Oct 8, 2012 at 2:41 PM

Hi,

I'm posting this discussion here instead of http://orchardcustomforms.codeplex.com because the code I'm referring to in the Item\Edit.cshtml of the CustomForms is only available in this repo.

Please advice if going forward we should start using this for module discussions/issues that are no longer in sub-repo's?

Basically I'm trying to get the title part onto another zone, I've tried all sorts of placement.info variations, matching CustomForm contenttype and also the backing contentype for the fields to no success.

I've also tried modifying the code to forcibly set the content type of the part being created in the Item\Edit.cshtml view like so: @Display(New.Parts_Title(ContentType:customForm).Title(Html.ItemDisplayText(customForm)))

But that didn't work either. Is there a reason why this part is only being created in the view and not in the controller?

How could I add it to the existing shape model so placement kicks in?

I've tried Model.Add(Display(New.Parts_Title().Title(Html.ItemDisplayText(customForm)))) in the view but that didn't work.

I'm still a bit new to shape factoring, and am not sure how to append it to the model in the controller, could anyone advise on how this could be accomplished?

Many thanks,

P.

Coordinator
Oct 10, 2012 at 1:27 AM

What do you mean "this part is only being created in the view and not in the controller"?

Oct 10, 2012 at 2:01 PM

sorry,

meant to say "this shape..."

and by "not in the controller" as why is it not being added to the shape model being sent to the view, thus shape placement being applied.

is it possible?

Coordinator
Oct 10, 2012 at 4:49 PM

I'm still not following. I see no such code in that file. Placement should work. One possibility is that you or somebody else went into admin placement on that type and set-up placement that is overriding what you're trying to set in placement.info.

Oct 10, 2012 at 6:10 PM

Maybe I should have specified, I'm using the Orchard.CustomForms module from the 1.x branch, the source code for the view that handles the submition of the form in the front end is: http://orchard.codeplex.com/SourceControl/changeset/view/c2cfde3d371d#src%2fOrchard.Web%2fModules%2fOrchard.CustomForms%2fViews%2fItem%2fCreate.cshtml

The bit of code I'm referring to is, @Display(New.Parts_Title().Title(Html.ItemDisplayText(customForm)))

I've tested it with a clean setup of the site, and did not modify the placement via the admin, and I can't figure out the correct Match for the Parts_Title to add to the placement.info.

I tried matching by content type (CustomForms and the actual content type for the fields) and URL but neither worked.

I specifically want to move it to a root zone <Place Parts_Title="/BeforeContent" />

I will test the admin placement now, to see if it works, as I didn't try that before.

Coordinator
Oct 10, 2012 at 6:16 PM

Ah, I see. Yes, it's a little strange that the title would be added this way, but you can simply override that template in your theme. Sending that shape to a different zone should be as simple as Layout.BeforeContent.Add(thatshape)

Oct 10, 2012 at 6:17 PM

Of course! why didn't I think of that! thank you so much :)

Feb 22, 2013 at 4:41 PM
I'm sorry to reply to an old thread, but I ran into this issue as well and found a good solution. You can override the Create view for Custom Forms by adding the same folder structure and view to your theme.

So in your views folder in the theme add: Orchard.CustomForms >> Item >> Create.cshtml

Form there you can change the Title, Submit button , and anything else.

Thanks