London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Anyone not come across this?
Not even the "native" DisplayTemplate view gives a value on form posting.
I removed the DisplayEditor view for SelectFragment and started over which solved the problem.
Must have been an error in the markup somewhere.
Below is the working razor view for SelectFragment.cshtml
@using EPiServer.XForms.Parsing
@model SelectFragment
<fieldset>
@foreach (SelectOption selectoption in Model.Options)
{
<div class="checkbox @(Model.Class.IsEmpty() ? "col-sm-12" : Model.Class)">
<label>
<input id="@selectoption.Id" name="@selectoption.Id" type="checkbox" value="true">
<input name="@selectoption.Id" type="hidden" value="false">
@selectoption.Value
</label>
</div>
}
</fieldset>
@Html.ValidationMessage(Model.Reference)
When posting a xform value from checkbox is always empty.
The view (SelectFragment.cshtml) looks like this:
@using EPiServer.XForms.Parsing
@model SelectFragment@foreach (SelectOption selectoption in Model.Options)
{
<div class="checkbox @(Model.Class.IsEmpty() ? "col-sm-12" : Model.Class)">
<label for="@selectoption.Id">
@Html.CheckBox(Model.Reference, selectoption.SelectedItem, new { id = selectoption.Id })
@Html.Raw(selectoption.Text)
</label>
</div>
}
@Html.ValidationMessage(Model.Reference)
Any ideas?