Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composite element isn't working

I'm trying to follow this tutorial by Matthew O'Phinney but not getting anywhere.

http://weierophinney.net/matthew/archives/217-Creating-composite-elements.html

All I'm trying to do is create a composite element that consists of a checkbox and an input text.

new Zend_Form_Element_Checkbox();
new Zend_Form_Element_Text()

The code I have got too complicated with lots of commenting in and out but nothing's working. I'm sure it's easier than this, but I seem to be on the wrong track.

like image 787
sameold Avatar asked Mar 23 '26 20:03

sameold


1 Answers

Here is a blog post to show you how to create one form element (an instance of Zend_Form_Element) that holds 2 input elements or more.

http://akrabat.com/zend-framework/a-zend-framwork-compount-form-element-for-dates/

You can also use subform to group more than one elements.
link: http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.subforms

    $subform = new Zend_Form_SubForm();
    $subform->addElement('checkbox', 'status', array(
        'decorators' => array(
            'ViewHelper',
        )
    ));
    $subform->addElement('text', 'test', array(
        'label'      => 'Text',
        'decorators' => array(
            'ViewHelper',
            'Label'
        )
    ));
    $this->addSubForm($subform, 'subformname');
like image 138
satrun77 Avatar answered Mar 25 '26 10:03

satrun77



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!