Try our conversational search powered by Generative AI!

XForms in MVC

Vote:
 

We are using Episerver 8 MVC and we are using XForms - which we are quite shocked why this has never progressed in the same way as Episerver has regarding Mobile optimisation.

Any way, we are looking to add a Red asterix alongside each required field - as this is required for assessibilty - this was missing way back n Episerver 6 R2 and we found a way to add an asterix but this was using Web forms - MVC in 8 seems like a completely different kettle of fish.

We have a method to change each Table format into the correct Divs but we cant see a way to add an Asterix - we are currently using this:

using (Html.BeginXForm(Model, htmlAttributes: new { @class = "form xform" }))
{
if (Model != null)
{
foreach (HtmlFragment fragment in (IEnumerable)ViewData["XFormFragments"] ?? Model.CreateHtmlFragments())
{
@Html.Fragment(XFormHelper.CleanupXFormHtmlMarkup(fragment))
}
}
}

Is this at all possible?

Thanks for your help

#131694
Aug 03, 2015 15:27
Vote:
 

One of the way to achieve this would be to override editor templates for data models used in XForm. You can take a look at original code here: \modules\_protected\CMS\EPiServer.Cms.Shell.UI.zip\Util\Views\Shared\EditorTemplates\. You would need to place these overwritten templates somewhere in your own site's views folders where view engine would be able to find those.

This enables you to overwrite XForm rendering completely.

#131703
Aug 03, 2015 20:38
Vote:
 

Ok, great thanks

#131780
Aug 05, 2015 10:55
Vote:
 
#132795
Aug 19, 2015 3:14
* 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.