Multiple Checkbox / Multiple Select in custom Block Edit

Permalink
I've duplicated the Page List block (and model) to add some custom "filtering." If the user selects "beneath another page" in the Block Edit, they will get a list of child pages to select from. My problem is that C5 doesn't like the old bracket INPUT naming (like below) to create an input array. I'd like to store the page ID of each box (page) checked.
<input type="checkbox" name="pages[]" value="46">Page 1<br/>
<input type="checkbox" name="pages[]" value="52">Page 2<br/>
<input type="checkbox" name="pages[]" value="73">Page 3<br/>


Anybody have any idea how to get a multi-checkbox (or multi-select) into the block's record? The inputs are generated dynamically from the site pages, so they will change.

Or better yet, is there already a "category" feature for pages? This is basically what I'm trying to accomplish with this.

Thanks!

dpidan
 
dpidan replied on at Permalink Reply
dpidan
Has no one else had problems getting multiple checkboxes or multiple select to work in their blocks? Am I going at this wrong?

I've done a work-around to get what I need.

I ended up using Javascript. When the Block's form is submitted, JavaScript parses the checkboxes "imploding" the page IDs into a single string/record - each separated by a comma. This string is then applied to one single text input for recording in the database.

The block's view.php or edit.php then explodes the string for the desired result.

Ping me if anyone's interested in seeing my files.
bcarone replied on at Permalink Reply
bcarone
Would like to see your implementation of this.

Sounds like it could be applied to several areas of discussion.

Bill
Remo replied on at Permalink Reply
Remo
I usually just override the save method and put these values in a second table. Allows me to do fast searches as well...

I wouldn't like it if c5 would put all the values into a single string field.

It might need a few more lines of code but handling them in the save method offers me a better flexibility.