November Happy Hour will be moved to Thursday December 5th.

Xform Checkboxs not storing values

Vote:
 

I'm struggling to get this to work. I'm not seeing the data getting saved from the checkbox's too and have tried many different iterations. 

I have read other posts but have tried their solutions and neither of them have worked. ( post 1post 2 )

Here are a few attempts:

//------------- Latest attempt

@model EPiServer.XForms.Parsing.SelectFragment

@foreach (EPiServer.XForms.Parsing.SelectOption selectoption in Model.Options) { var refName = selectoption.Id.Replace(" ", "").Replace(".", "").Replace(",", "");
} @Html.ValidationMessage(@"" + Model.ValidationReference + "")
//------------- Original code
@if (!string.IsNullOrEmpty(modelLabel)) { } @foreach (EPiServer.XForms.Parsing.SelectOption selectoption in Model.Options) {
@Html.CheckBox(Model.Reference, selectoption.SelectedItem, new { id = Model.Reference + "-" + selectoption.Value })
} @Html.ValidationMessage(@"" + Model.ValidationReference + "")
#132622
Aug 14, 2015 0:37
Vote:
 

I'm also wondering what the ID of the field needs to be to feed the data back correctly through the post. 

#132816
Edited, Aug 19, 2015 6:33
Vote:
 

I've used this with success

@model EPiServer.XForms.Parsing.SelectFragment
<div class="row">
    <div class="xform @Model.Orientation @Model.Class">
        <label class="margin-bottom" for="@Model.Reference">@Model.Label @Html.ValidationMessage(Model.ValidationReference, "*")</label>
        @foreach (var checkBox in Model.Options)
        {
            <label for="@( Model.Reference + checkBox.Value)" class="xform-checkbox">
                @Html.CheckBox(Model.Reference + checkBox.Value, checkBox.SelectedItem, new { @title = Model.Title })
                @checkBox.Text
            </label>
        }
    </div>
</div>
#133249
Aug 30, 2015 19:28
* 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.