associated array elements in zend form
- by ToonMariner
Hi,
Been trying to find a solution for this for a while with not much luck...
Need to render a form with an array of checkboxes each having an associated textbox.
given an array of array('Dave'=23,'Pete'=12,'Si'=43);
the resulting mark-up should yield:
<div>
<label><input type="checkbox" name="user_id[]" id="user_id-1" value="23" />Dave</label>
<label for="job-1">Job:</label><input type="text" name="job[]" id="job-1" />
</div>
<div>
<label><input type="checkbox" name="user_id[]" id="user_id-2" value="12" />Pete</label>
<label for="job-2">Job:</label><input type="text" name="job[]" id="job-2" />
</div>
<div>
<label><input type="checkbox" name="user_id[]" id="user_id-3" value="43" />Si</label>
<label for="job-3">Job:</label><input type="text" name="job[]" id="job-3" />
</div>
Complete zend noob so any help appreciuated (including decorators etc.)
Thanks peeps