Zend Form: How do I make it bend to my will?

后端 未结 14 1527
你的背包
你的背包 2021-01-29 18:53

I\'ve read the manual many times, I\'ve scoured the posts offered by Google on the subject, I have even bought a couple of books that deal with ZF. Now, why am I still confused?

14条回答
  •  滥情空心
    2021-01-29 19:44

    If you just want to add arbitrary markup before or after your form elements without using the ViewScript decorator, you could use my AnyMarkup decorator: http://www.zfsnippets.com/snippets/view/id/62

    For example, here is how you would prepend an input field with an image inside a wrapper tag (needs include paths for autoloading to be set correctly):

    $form->addElement('text', 'my_field', array(
      'label' => 'Enter Info:',
      'decorators' => array(
        'ViewHelper',
        array('AnyMarkup', array(
          'markup' => ''),
          'placement' => 'prepend'
        ),
        'HtmlTag',
        'Label'
      )
    );
    

提交回复
热议问题