This project is read-only.


Topics: Troubleshooting, Writing modules
Dec 29, 2011 at 5:32 AM

Evening everyone.

Does anyone have an implementation of a checkbox group that works with Orchard Drivers? I am currently trying the following like to no success:

My Driver passes a CourseEditViewModel to the edit form. The view model has the CoursePart, AllCheckboxValues, SelectedCheckboxValues properties.
I am able to successfully get the checkboxes to show on the form. However, the values are not being persisted back to the part.

I suspect it's because the Driver Editor method that accepts the form POST only has an override that takes CoursePart and I can't actually pass the CourseEditViewModel that is actually bound to the form back to the controller.

Consequently, my SelectedCheckboxValues property on my CoursePartRecord is never being updated.

Any thoughts or ideas?

Dec 29, 2011 at 9:43 AM

Solved by capturing the form post values from the checkboxes and applying them directly to the CoursePart passed in to the Editor POST method.
This causes the model to be validated and saved properly.

A bit of a hack, but workable enough for now.

It would definitely be nice to see an official Orchard CheckBoxList field that can be bound to something like a collection or even a comman-separated list.

Thanks all,

Dec 29, 2011 at 11:38 AM

Suggest it in the Feature Team: Core Fields thread.