سؤال

Hi I want to Design a Zend_form As following:

Question:1

<form>
First name: <input type="text" name="firstname">
Last name: <input type="text" name="lastname">
<div id="block">
<fieldset id="fieldblock">
Lable: <input type="text" name="input1">
Lable: <input type="text" name="input1">
Lable: <input type="text" name="input1">
Lable: <input type="text" name="input1">
</fieldset>
</div>
</form>

My Current OutPut:

<form>
First name: <input type="text" name="firstname">
Last name: <input type="text" name="lastname">
<div id="block">
Lable: <input type="text" name="input1">
Lable: <input type="text" name="input2">
Lable: <input type="text" name="input3">
Lable: <input type="text" name="input4">
</div>
</form>

I am using the following Decrotives:

$this->addDisplayGroup(array('input1','input2','input3','input4'),
                                       'Date', array('order'     => 4,
                                                    'decorators' => array('FormElements',
                                                                        array('HtmlTag', 
                                                                            array('tag'     => 'div',
                                                                                 'class'    => 'block',
                                                                                 ),
                                                                             ),
                                                                          ),
                                                    )
                                );

How to Add Field Set to the setgroup?

Question:2

Expected OOUTPUT:

<form>
First name: <input type="text" name="firstname">
Last name: <input type="text" name="lastname">
<div id="block">
<fieldset id="fieldblock">
Lable: <input type="text" name="input1">
Lable: <input type="text" name="input1">
<div id="block2">
Lable: <input type="text" name="input1">
Lable: <input type="text" name="input1">
<div id="block2">
</fieldset>
</div>
</form>

IF I want to add "addDisplayGroup" inside Another Display Group, How Can I do it? Thanks in advance!!

هل كانت مفيدة؟

المحلول

Soon I will post the answer:

I refer the following three links and Solved my issue hope it will be useful for others.

Ref Link 1 http://jamestombs.co.uk/2008-04-24/zend-adddisplaygroup-setting-the-legend/767

Ref Link 2: http://jamestombs.co.uk/2008-04-24/zend-adddisplaygroup-setting-the-legend/767

Ref Like 3: http://zendguru.wordpress.com/2008/11/11/applying-decorators-to-all-elements-of-form-elements-at-once/

This three links are very use full to understand the for decorative.

Answer:1

$this->addDisplayGroup(array('input1','input2','input3','input4'),
                                       'Date', array('order'     => 4,
                                                    'decorators' => array('FormElements',
                                                                        array('HtmlTag', 'Fieldset'
                                                                            array('tag'     => 'div',
                                                                                 'class'    => 'block',
                                                                                 ),
                                                                             ),
                                                                          ),
                                                    )
                                );
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top