Quickform layout and groups.
| From: | Tudor Holton | Date: | Wed, 05 Apr 2006 06:36:19 +0000 |
| Subject: | Quickform layout and groups. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23540@lists.php.net to get a copy of this message | ||
Hello,
First, let me thank you for all your great work on Pear and, more specifically HTML_QuickForm! :-)
I have been playing with HTML_QuickForm for a few days and have been trying to reproduce some of our existing forms.
I have come across an interesting problem that I can't seem to get around.
Our forms have fields placed in rows, and aligned so that the form fits a square. To do this in HTML_QuickForm, I placed each line in a group.
However, when I do this, the labels for each field disappear.
What I'm trying to do is something like this:
<table>
<tr>
<td>Name:</td>
<td>First:<br /><input type="text" name="firstName" /></td>
<td>Middles:<br /><input type="text" name="middleNames" /></td>
<td>Last:<br /><input type="text" name="lastName" /></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="address" /></td>
</tr>
</table>
However, a closer approximation to our existing forms is like this:
<table>
<tr>
<td rowspan="2">Name:</td>
<td align="left">First:</td>
<td align="left">Middles:</td>
<td align="left">Last:</td>
</tr>
<tr>
<td align="left"><input type="text" name="firstName" /></td>
<td align="center"><input type="text" name="middleNames" /></td>
<td align="right"><input type="text" name="lastName" /></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="address" /></td>
</tr>
</table>
The end result is that each field has its label above rather than beside, but only when the elements are grouped!
Is there a way to do this in HTML_QuickForm?
More generally, where should I look for making my forms look tighter? One line per field makes for some very long forms, yet grouping doesn't seem to be quite what I'm looking for.
I have tried looking at templates, but it all seems a bit confusing and overcomplicated for something simple like this.
Another way to look at it would be to add a formatting to each of the group's elements and tell it to place the label above,
then tell the group to show the elements labels. How would I go about doing this?
I'd imagine I'm missing something quite obvious, so I apologise in advance if the answer is too obvious. :-)
You help is greatly appreciated.
Cheers,
Tudor.