php - zend : populating a checkbox array with $form->populate(); from controller -


we have zend form text input fields , array of checkboxes, shown below -

<input class="checkbox_category" type="checkbox" name="tag[]" value="19"> somename1 <br/> <input class="checkbox_category" type="checkbox" name="tag[]" value="20"> somename2 <br/> <input class="checkbox_category" type="checkbox" name="tag[]" value="21"> somename3 <br/> 

and using

$formobject->populate($formdataarray);

in controller populate data in whole form. text input fields seem populate fine, checkboxes don't. int $formdataarray, data checkboxes in format

[tag] => array ( [0] => 20 [1] => 19 )

along other form data - [firstname] => 'somename' etc. not able figure out format of data form expecting, in order populated populate();

hi might problem name have given array please change below

<input class="checkbox_category" type="checkbox" name="tag" value="19"> somename1 <br/> <input class="checkbox_category" type="checkbox" name="tag" value="20"> somename2 <br/> <input class="checkbox_category" type="checkbox" name="tag" value="21"> somename3 <br/> 

please let me know if can further


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -