We have a number of user controls to port from our old pre-EpiServer website to our new EpiServer website. For each one we need to decide whether to do them as a dynamic content control or an X-Form. Obviously X-Forms are good in that in theory they can be modified or edited by editors without developers getting involved and without any code releases. Any updates to dynamic content controls require developers to do them and a new code release to be made.
All of our controls have some level of functionality, such as required field validators, hidden fields that reveal themselves on certain inputs etc. In these cases it is more difficult to do these as X-Forms than as dynamic content controls.
I would like to here your experiences of using both techniques for your user controls and whether your experience with them has made you lean towards using X-Forms rather than dynamic content controls or vice versa.
I am also intersted in this topic. It would be great to get some responses with other users experiences. Cheers.
I would suspect that user controls is the way to go but I think that you need to take some more questions into consideration when taking the decision:
Are users supposed to add these blocks directly into content?How should data that is stored and treated? XForms has the advantage of solving storage and some user interaction with the data for you.
If there's a lot of dynamic interaction like fields being shown/hidden due to user interaction I would certainly go with user controls since this is not supported out of the box in the EPiServer XForms implementation and it's a bit tricky to get done when the form is a changing target that the editors can edit.
RegardsLinus EkströmEPiServer Development Team
In my case editors want the possibility to add WebForms to different page types. They want the flexibility to decide which items to add (textboxes, textareas, checkboxes, etc.), labels, etc. I have been doing a research and XForms seems to fit the requirements we have, though it is really hard to find documentation on the topic. Concenring on how they will treat the data, I think the ability to export it as Excel or XML will do the job.
If I am right the user control approach will not have the flexibility of XForms in the way tha XForms lets quite easy add/remove items to the form as well as some styling and validation, right? Any other things I should take in consideration? Thanks for the advice.
For simpler forms I would surely go for EPiServer XForms since it's already in the product. If you have strong requirements of having dynamic forms (items 2 is shown when item 1 has vallue x etc.) I would have to weigh the cost of implementing this from scratch (or looking for a third party library) to trying to extend the XForms functionality. Unfortunately you are somewhat limited to what you can do with the XForms functionality. There are several server side events which makes is possible to alter your form but there is no built in support to change the actual edit UI. Anders Hattestad has written a blog post on how to extend the UI http://world.episerver.com/Blogs/Anders-Hattestad/Dates/2010/5/Extend-EPiServer-XForm/.
The webforms are gonna be quite simple and will not require dynamic features, therefore I think XForms will be an easier implementation for this case. I agree it has it's limitations but so far I think it covers all our requirements. Thanks for your input and for the link.
After playing a bit more with the XForms and doing some testing, I ran into a new request. Is it possible to choose where to save the data from the XForm? E.g. Specify a different DB and/or table?
If you want the XForm data to be stored somewhere else, you need to handle this from code. You can hook in to the BeforeSubmitPostedData event on the EPiServer.XForms.WebControls.XFormControl and add necessary logic there.
Thanks for the reply Mari, I'll check that method to change this setting.
How can i access the XForms controls in code window? Thanks in advance.........
Have you read the tech note? http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-6-R2/XForms/
I am new to EPISERVER.........Thank u Linus.......I am going through that......if any issues.....i wil get back here.............