activeCheckBoxList display problem

Hi all,

I am not sure if anyone else ran into this issue. I needed to render 10 checkboxes on a form so I chose to use activeCheckboxlist in order to accomplish. It worked perfectly but the problem is when it renders it doesn’t give me any option on how to modify the rendering. I would like to render the checkbox like this (x is the checkbox)

X x

X x

X x

X x

X x

but unfortunately it is rendered as follows:

x

x

x

x

x

x

x

x

x

x

x

Does anyone have any clue on how to modify how the checkboxlist sends results?

Thanks,

Trevor

See: http://www.yiiframework.com/doc/api/1.0.11/CHtml#activeCheckBoxList-detail

htmlOptions parameter, "separator" or "template"

Roberto,

Thanks for your response. I used the template parameter but it would output the checkboxes incorrectly. Any other suggestions? I used ‘template’=>’<tr><td><{input} {label}</td><td>{input} {label}</td></tr>’

but this outputs the checkboxes incorrectly. It outputs the same id twice. I want them to be separate ids.

Thanks,

Trevor

I don’t understand what you mean by those X’s.

Can you post a sample HTML output that you are getting, and a sample HTML output that you are trying to acheive.

Forum software has been known to change case by it’s own.

/Tommy

Sorry Gstar. The x’s lost their formatting. I would like to have something like the following

<tr><td>{label] [input]</td><td>[label] [input]</td></tr>

I have tried to do this with ‘template’ but it creates the same checkbox with the same value and id twice.

Any help would be greatly appreciated.

I think what Roberto sais is ok.

Why not use ‘separator’=>’’ and then with css do the positioning?

May be you add some class to every checobox and with ‘width’, ‘position’ and other properties of css do the positioning…

ok, I will try. Not sure how to do css positioning to make every 2nd checkbox move to the 2nd line. I will have to research that.

I figured it out. Thanks everyone for your help

Could you give picture of your realization?:slight_smile:

I’m facing such a problem here

If you are using the default forms css, it sets the display of labels to block which would explain why the checkbox and the label are rendered on different lines.

Yes, it’s not a problem, because I put them in the table and problem solves(IN VIEW) but I use separate activeCheckBox here and need to verify that one of those seven checkbox’es should be market. Maybe I could solve this with before save?