开发者

Setting decorators to Zend_Form_Element_Checkbox

开发者 https://www.devze.com 2022-12-17 04:59 出处:网络
I have a zend form comprised of 4 subforms. 1 of these subforms has 4 elements, and one of those elements is a zend_form_element_checkbox.

I have a zend form comprised of 4 subforms. 1 of these subforms has 4 elements, and one of those elements is a zend_form_element_checkbox. I have 4 different display groups (1 for each subform) - one is : 'billing address', one is 'credit card info' , 'notifications' and 'misc'

Assuming that 'notifications' is the part that has the checkbox element, if i dont use any decorators except the following, and dont use any display groups, everything displays as expected i.e.:

Notify me [] <------ is the checkbox

These are the css im using for the dd and dt tags in the form

dt{
    display: block;
    margin: 0;
    padding: 0 0 10px 10px;
    width: 220px;
    text-align: left;
}

dd{
   display: inherit;
   margin: 0;
   padding: 0 0 10px 10px;
   width: 200px;
   float: left;
}

Now, when i'm displaying the sub-form as a display group, i'm using this:

$notificationsGroup->setDecorators(array(
     'FormElements',
      'FieldSet',
      array('HtmlTag',
             array('tag'=>'div',
                   'style'=>'width:90%;padding-left:45px;paddin开发者_运维百科g-bottom:25px;'))
                    ));

The end result is, all the elements come within the display group except for the actual check box (like - only the box - the label for the check box comes within the display group)

I have tried using other tags, and nothing seems to be working. Is it something to do with the 'div' tag ? Something else I'm missing? Appreciate all thoughts and responses.


You could try using a class name instead of the inline style declaration in your code.

$notificationsGroup->setDecorators(array(
     'FormElements',
      'FieldSet',
      array('HtmlTag',
             array('tag'=>'div',
                   'style'=>'cssclassname'))
                    ));
0

精彩评论

暂无评论...
验证码 换一张
取 消