HTML_QuickForm, Groups within Groups
| From: | Trevan Devaun Richins | Date: | Wed, 30 Jun 2004 15:42:16 +0000 |
| Subject: | HTML_QuickForm, Groups within Groups | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13419@lists.php.net to get a copy of this message | ||
I am currently using a modified HTML_QuickForm to handle groups within groups but when I requested it to be implemented in HTML_QuickForm, they said that I can do it differently. I just don't see how. I am asking if anybody knows how. Here is my problem.
I am currently pulling out of MySQL an array of comments given to a user (the amount changes for each user). This is how it would look:
[comments] => Array
(
[0] => Array
(
[id] => 104
[comment] => aoeuaoethoaeu
[submitter] => Me
[datetime] => 20040603152421
)
[1] => Array
(
[id] => 106
[comment] => aoeunthaicr,atichaotjhic.
[submitter] => Me
[datetime] => 20040608112939
)
)
In my form, I want ID to be a checkbox, giving the user the power to delete the comment. The comment, submitter, and datetime will be static elements. I am creating a group called comments_delete that has inside of it groups that each contain the id checkbox and three static elements (so four elements total). Then in my Smarty template I have this code to loop through the outer, then the inner group and output the info.
{foreach from=$form.comments_delete item=comment key=number}
{if is_int($number)} // This is because I want to make sure it only outputs the comments and not other stuff that ArraySmarty creates
<tr>
<td align='right' width='200' valign='top'>Delete?</td>
<td width='50' valign='top'>{$comment.id.html}</td>
<td align='left'>Comment: {$comment.comment.html}<br>Date: {$comment.datetime.html}<br>Submitter: {$comment.submitter.html}</td>
</tr>
{/if}
{/foreach}
It works for me, and the modification in HTML_QuickForm was actually very easy. Is there something I should change in my logic? I would like to either change my logic or have HTML_QuickForm modified. I don't want to keep making my own modifications every time HTML_QuickForm is updated.
Thanks
Trevan