Page dosen't remember selected values from Checkboxlist on postback. MVC form
Hello! I’m having trouble with a contact form where I want a CheckBoxList. I'm using the mvccbl extencion [http://mvccbl.com/].
I want the user to check at least one from the list. When you do that, but doesn't fill in the other fields and submit, the server validates the form. Since the name and email is required the form returns invalid. But now the page doesn't remember the one which is selected from the list. Also the unobtrusive validation dosent kick in at the cbl???
using (Html.BeginUmbracoForm<ContactSurfaceController>("handleContactForm")){
@Html.ValidationSummary(true)
@Html.AntiForgeryToken()
var htmlListInfo = newHtmlListInfo(HtmlTag.table, 2, new { @class = "checkboxlist-table" }, TextLayout.Default, TemplateIsUsed.No);
<divclass="omraader form-group">
<h5>Hvad ønsker du at blive kontaktet angående? <spanclass="f_required">*>>
@Html.CheckBoxListFor(
x => x.PostedOmraader.OmraaderIDs,
x => x.AvailableOmraader,
x => x.Id,
x => x.Name,
x => x.SelectedOmraader,
htmlListInfo,
x => new { @class="cblOmraade checkbox" }
)
Page dosen't remember selected values from Checkboxlist on postback. MVC form
Hello! I’m having trouble with a contact form where I want a CheckBoxList. I'm using the mvccbl extencion [http://mvccbl.com/].
I want the user to check at least one from the list. When you do that, but doesn't fill in the other fields and submit, the server validates the form. Since the name and email is required the form returns invalid. But now the page doesn't remember the one which is selected from the list.
Also the unobtrusive validation dosent kick in at the cbl???
This can be seen on www4.etlgroup.dk/privat/kontakt-os/
So far I have:
Omraade.cs
ContactModel.cs
ContactSurfaceController.cs
Contact.cshtml
ContactForm.cshtml
I hope you can help me. And thanks in advance :)
is working on a reply...