后,我加装饰我的Zend的形式,它有一些不必要的
如何删除不需要的 由Zend的形式产生
像 - >
<dt id="step1-label"> </dt>
我的问题是,我将我的表格后, div在我的phtml。 div和form之间有空格,我不能删除那个空格,你能帮我吗?
我的完整形式是
class Admin_Form_RatesForm extends Zend_Form
{
/**
* Form's set values and multy options
* @var array
*/
private $options;
/**
* Initailise options arrays
* @param $options
*/
public function __construct($options = null)
{
if(isset($options)){
$this->options = $options;
}
parent::__construct();
$this->setMethod('post');
}
/**
* Set form elements
* Add elements to display groups
*/
public function init(){
//intalise to local varible
$options = $this->options;
//show room type selector
$roomTypes = new Zend_Form_Element_Select('room_types');
$roomTypes->setLabel('Room Type :');
$roomTypes->addMultiOption('All', 'ALL');
$roomTypes->addMultiOptions($options['room_types']);
$roomTypes->setDecorators(
array(
'ViewHelper',
'Description',
'Errors',
array('Label',
array(
'class' => 'label' , 'class' => 'margin-bot20'
)
),
array('HtmlTag',
array('tag' => 'div', 'class' => 'floatleft margin-bot20')
),
array(
array('td' => 'HtmlTag'), array('tag' => 'td')
)
)
);
//show offers selector
$offers = new Zend_Form_Element_Select('offers');
$offers->setLabel('Offer :');
$offers->addMultiOptions($options['offers']);
$offers->setDecorators(
array(
'ViewHelper',
'Description',
'Errors',
array('Label',
array(
'class' => 'label' , 'class' => 'margin-bot20'
)
),
array('HtmlTag',
array('tag' => 'div', 'class' => 'floatleft margin-bot20')
),
array(
array('td' => 'HtmlTag'), array('tag' => 'td')
)
)
);
//insert button
$insert = new Zend_Form_Element_Button('insert');
$insert->setLabel('Insert Rates');
$insert->setDecorators(
array(
'ViewHelper',
'Description',
'Errors',
array('Label',
array(
'class' => 'label' , 'class' => 'margin-bot20'
)
),
array('HtmlTag',
array('tag' => 'div', 'class' => 'floatright margin-bot20')
),
array(
array('td' => 'HtmlTag'), array('tag' => 'td')
)
)
);
//make date picker using js
$fromDate = new Zend_Form_Element_Text('from_date');
$fromDate->setLabel("Valid from : ");
//make date picker using js
$toDate = new Zend_Form_Element_Text('to_date');
$toDate->setLabel('to :');
//make radio buttons
//show display groups according to click redio button
$type = new Zend_Form_Element_Radio('type');
$type->setLabel('Type');
$type->addMultiOption('per', 'Percentage');
$type->addMultiOption('fix','Fixed');
//use for set presetage rate
$percent = new Zend_Form_Element_Text('percent');
$percent->setLabel($options['precent_lable']);
$percent->class = 'number';
//make grid form for set fixed values
$fixed = new Zend_Form_Element_Hidden('fixed');
$fixed->setDecorators(
array(
array(
'ViewScript',
array(
'viewScript' => 'customviewscripts/_fixedgrid.phtml',
'meal_plans' => $options['meal_plans'],
'room_types' => $options['room_types']
)
)
)
);
//submit button
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Submit For Approval');
$submit->class="submit";
//show default form
$this->addElements(
array(
$roomTypes,
$offers,
$insert
)
);
$step1 = $this->addDisplayGroup(
array(
'room_types',
'offers',
'insert'
), 'step1',
array('dtLabel' => '')
);
//show after click insert button
$this->addElements(
array(
$fromDate,
$toDate,
$type,
$percent,
$fixed,
$submit
)
);
$step2 = $this->addDisplayGroup(
array(
'from_date',
'to_date',
'type',
'percent',
'fixed',
'submit'
), 'step2',
array('dtLabel' => '')
);
}
}
它通常最好不要覆盖的形式构造。无论如何,默认方法是'post' – Phil 2011-05-05 04:29:17
我认为在添加显示组时会生成空格 – 2011-05-05 04:36:10
编辑问题时,请确保选择整个代码块并按CTRL + K或花括号图标'{} '将它包装在代码块中 – JohnP 2011-05-05 05:16:53