For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2004 > HTML_QuickForm, Groups within Groups









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTML_QuickForm, Groups within Groups
Trevan Devaun Richins

2004-06-30, 3:58 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com