XForms html markup


Hi, I'm working in a new EPiServer 8 MVC project, and I've followed this nice post (thanks Nicola) to get the XForms working:


But now I need a complete different rendering html markup for my xform, it has many fields and some kind of a special design (some fields per row, with label for each field).

What would be the way to achieve this??? I'm thinking about creating a specific viewmodel, that accepts a xform as a property, and rendering the fields in a new view that accepts this viewmodel, so in this way I've complete control of the markup. But it seems a little complicate to me, I want to keep it simple...is there a better way to render a XForm with complete control on the html markup?

Anyway, I'm not sure how can I get the fields from the XForm to render them as desired........suggestions????


Jul 29, 2015 23:08


Another simple(not best) way to render can be...
If your XForm is of fixed fields and editors will not extend the XForm ...
then write your HTML and design as complex as you want in HTML and post the XFORM in coding.


Jul 30, 2015 9:10

I'll try in some way...Thank you.

But how "and post the XFORM in coding."??? Have you a link to a code sample to do this????


Edited, Jul 30, 2015 9:31

XForms are most likely going away and I wouldn't bet on some kind of conversion tool being able to convert between XForm forms+data and their replacement.

So if you are already needing a bunch of custom stuff and also complete markup control I would look into putting the data somewhere custom as well and add some plugin where the data can be viewed and exported.

Jul 30, 2015 15:05

"putting the data somewhere custom as well and add some plugin where the data can be viewed and exported."...............hhhhmmmmm interesting idea, can you be more specific about "putting the data somewhere somewhere" and "some plugin"??????


Jul 30, 2015 15:12
//On form submit

xForm = EPiServer.XForms.XForm.CreateInstance(Your X form guid);
//set xForm properties

Edited, Jul 30, 2015 15:22

I would add my own database table(s) and use Dapper or Entity Framework for saving the data collected from the form.

In my own edit or admin mode plugin I would query that table and output data as required (usually with some export, search and filtering functionality).

The form and actions would be done similiar to this:

Jul 30, 2015 15:27

As easy as it looks.........Thank you Mr. Khan!!!

Edited, Jul 30, 2015 15:27

Thank you Johan!!!!...you and Mr. Khan propose different solutions,...I'll think which is best/simple for my project.


Jul 30, 2015 15:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.