Friday, 15 January 2010

php - div => false is not working in CakepPHP input() FormHelper -



php - div => false is not working in CakepPHP input() FormHelper -

i using lastly version of cakephp, follow code have create list of checkboxes.

echo $this->form->input('regions', array( 'type' => 'select', 'hiddenfield' => false, 'options' => $regions, 'multiple' => 'checkbox', 'div' => false ));

the code works 90%, mean... list has been created still see <div>

this result:

<div class="checkbox"><input type="checkbox" name="data[regions][]" value="1" id="regions1" /><label for="regions1">aaaa</label></div> <div class="checkbox"><input type="checkbox" name="data[regions][]" value="2" id="regions2" /><label for="regions2">bbbb</label></div> <div class="checkbox"><input type="checkbox" name="data[regions][]" value="3" id="regions3" /><label for="regions3">cccc</label></div>

the result need is:

<li> <input type="checkbox" name="data[regions][]" value="1" id="regions1" /><label for="regions1">aaaa</label> </li> ...

how can ?

by setting 'div' => false, prevents creating <div> around whole input section (i.e. set of checkboxes). want disable div's around option. unfortunately, have not been able find way disable cake.

however, can simulate <li> items css trickery. encapsulate inputs in div special class (the opposite of doing now), utilize css forcefulness using <li> styling:

in css:

.box2li div { display: list-item; }

in cake view:

echo $this->form->input('regions', array( 'type' => 'select', 'hiddenfield' => false, 'options' => $regions, 'multiple' => 'checkbox', 'div' => array ('class' => 'box2li') ));

each checkbox preceded a... ...bullet

php cakephp cakephp-2.0

No comments:

Post a Comment