2010年12月10日星期五

Re: [fw-mvc] Zend Form with Multiple Columns

On Friday 10 Dec 2010 22:41:59 Thomas List wrote:
> I understand the concept of creating multiple columns in a Zend Form, but I
> really don't know how to create the subforms, and the display groups to do
> so. I can't really seem to find any examples on the web, and I think I
> could figure it out if I had a little extra information. I've been
> searching Google for a couple of Days now trying to solve this problem,
> and I can't seem to find any example of anyone actually creating a form
> with 2 columns. Any help would be very much appreciated.
>
> Regards,
> Thomas

Subforms [1] and displaygroups [2] are explained at the Zend Framework manual.
It's rather straightforward to use. Please read them and follow the examples.

To give another example, I created two columns like this:

$form = new Zend_Form;
$form->addElement('text', 'address');
$form->addElement('text', 'shipping_address');
... more elements added
$form->addDisplayGroup(array('address'), 'standard');
$form->addDisplayGroup(array('shipping_address'), 'shipping');


Now you get two fieldsets, one with id #fieldset-standard and one with #fieldset-
shipping. A following css rule gives two columns:

#fieldset-standard, #fieldset-shipping {
width: 500px;
float: left;
}

Regards, Jurian

[1]
http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.subforms
[2]
http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.displaygroups
--
Jurian Sluiman
Soflomo - http://soflomo.com

没有评论: