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????
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.
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????
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.
"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"??????
//On form submit
xForm = EPiServer.XForms.XForm.CreateInstance(Your X form guid);
//set xForm properties
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: http://krompaco.nu/2015/01/working-with-your-own-forms-in-episerver-and-mvc/
As easy as it looks.........Thank you Mr. Khan!!!
Thank you Johan!!!!...you and Mr. Khan propose different solutions,...I'll think which is best/simple for my project.