开发者

Zend Framework: How do I modify/format the form view generated with Zend_Dojo_Form elements

开发者 https://www.devze.com 2023-01-03 14:27 出处:网络
I have created a form: <?php class Application_Form_Issue extends Zend_Dojo_Form { public function init()

I have created a form:

<?php
class Application_Form_Issue extends Zend_Dojo_Form
{
    public function init()
    {
        $this->setName('issue');
        $this->setMethod('post');

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');

        $date_recvd = new Zend_Dojo_Form_Element_DateTextBox('date_recvd');
        $date_recvd->setLabel('Date Received')
               //->setRequired(true)
               /*->addValidator('NotEmpty'); */; 

        More Form elements ...

To view this form my view script is:

<?php echo $this->form; ?>

This all works just fine, with fully functional dojo form elements (datepicker, timepicker, etc) and successfully saving the data.

However, now, I want to format the form that is generated with css. Such as grouping some elements and floating left or right, making some input text fields wider/narrower, e开发者_如何转开发tc. How?

I realize I can modify the view script but it seems like that defeats the purpose of using Zend_Dojo_Form or Zend_Form. Is that a correct assumption?


Zend_Form works off decorators for each of the elements. IMO it really just provides a quick means of getting a form into the view. However, if you need to perform more advanced css tricks on your elements, I would recommend that you set the CSS for each element in the view.

<?= $this->form->elementOne ?>
0

精彩评论

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

关注公众号