Custom Forms Alternates

Topics: Customizing Orchard, General, Writing themes
Jul 31, 2012 at 3:04 PM

I've been playing with the cutom forms feature and have found that when the form is displayed each field within the content type is displayed within it's own fieldset tag rather than having a single fieldset around the whole form.

No problem I thought I'll just fire up the shape tracer and create a few alternates to remove the fieldsets that surround each form field and add one around the whol form. Unfortunately when I try and create an alternate through the Shape Tracer module for EditorTemplate I get tehe following error:

"An unexpected exception was caught System.ArgumentException: The relative virtual path 'Orchard.Core.Shapes.CoreShapes::EditorTemplate' is not allowed here."

Any ideas?

Coordinator
Jul 31, 2012 at 4:24 PM

Please file a bug with repro steps.

As a workaround, just create those alternate files manually.

Jul 31, 2012 at 8:03 PM

Thanks Bertrand, I shall file a bug shortly.

In the meantime any idea where I can find the default views that I need to create alternates for?

Coordinator
Aug 2, 2012 at 4:34 PM

Isn't shape tracing telling you? From what you said, it seemed like the create button wasn't working but the alternates should still be shown, right?

Aug 2, 2012 at 6:16 PM
bertrandleroy wrote:

Isn't shape tracing telling you? From what you said, it seemed like the create button wasn't working but the alternates should still be shown, right?

It tells me the name for the alternate so that I can override it but when I try and view the template it returns "Content not available as coming from source code." I mainly wanted to see what it should actually look like before I try and create an alternate manually.

Coordinator
Aug 3, 2012 at 12:03 AM

So you are attempting to create an alternate for a shape that is defined in code, not in a template? Then you are on your own to write an alternate template based on the code for the shape, and shape tracing can't help.

What shape is this?

Aug 3, 2012 at 11:02 AM

It's the EditorTemplate. I basically followed the guide here: http://devdirective.com/post/160/how-to-create-custom-forms-in-orchard-cms-with-email-and-recaptcha however when viewing the form each of the fields is surrounded by its own fieldset tag rather than a single fieldset tag surrounding the form itself. I can hide this using CSS however I'd rather that it wasn't there in the first place so wanted to ceate an alternate for it.

Coordinator
Aug 3, 2012 at 6:55 PM

Makes sense, but I think each fieldset is rendered by the part's template, not by the outer editor shape. That means you would probably need to go into each of them and create alternates. That doesn't sound like it would scale well (plus you'd still need to create your own form.cshtml and add the fieldset in there). CSS may unfortunately be your easiest bet in this case.

Jun 11, 2013 at 4:25 PM
Hi All,

I came across with the same issue. Is there any way to override EditorTemplate shape? BuildEditor() and BuildDisplay() are the excellent feature, but there should be a way to change wrappers.

Bertrand: "So you are attempting to create an alternate for a shape that is defined in code, not in a template? Then you are on your own to write an alternate template based on the code for the shape, and shape tracing can't help."

Can you elaborate this please ?

Regards,
Hayri
Coordinator
Jun 26, 2013 at 7:56 AM
You need to look at the code for that shape, and reproduce what it's doing in your alternate template.