Preserve field order when creating in custom Orchard CMS forms

I created a custom form and added the fields in a specific order. The form is similar to a questionnaire in which the next question is a continuation of the previous question (s) above it.

I tried to change the placement.info file, but I can only change the sequence for each control type (numeric value before datetime, boolean before text) ...

I tried to make the order number the same, hoping that the "default" ordering of fields at creation time would take effect - no joy.

<Place Fields_Input_Edit="Content:2.0"/>
<Place Fields_Input="Content:after"/>
<!-- Numeric -->
<Place Fields_Numeric_Edit="Content:2.0"/>
<Place Fields_Numeric="Content:after"/>

      

So my guess is the next step here is to use the shape constructor, check the "widget" and override it (Shape-> Alternate-Create)? It generates a file (like Widget-url-membership-online-application.cshtml) and I think I'll start working from that file?

The content of the file just shows this:

@Display(Model.Content)

      

How do I refer to a specific field, I can do something like:

<label for="FirstName">@T("Your First Name")</label>
<input id="FirstName" class="text" name="FirstName" type="text" value="@Model.??????"/>

      

There must be an easier way!

+3


source to share


1 answer


You can use the Edit Placement button in the Content Type Editor or ...

You can target a specific field by following these instructions: http://docs.orchardproject.net/Documentation/Understanding-placement-info# "Place" Element



For example, <Place Fields_Common_Text-Occupation="Content:2"/>

You can also use Match tags to target a specific content type or a specific URL (see the same topic I pointed out above).

+4


source







All Articles