本文介紹了在一行上顯示 Zend_Form_Element_Radio的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
Zend Framework 中的單選按鈕顯示在一列中(每行一個選項).如何從標記中刪除 br 標簽,以便所有單選選項都在一行中?
The radio buttons in Zend Framework are displayed in a column (one option per line). How can I remove the br tag from the markup so that all radio options stay in one line?
我的裝飾者是:
private $radioDecorators = array(
'Label',
'ViewHelper',
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'radio')),
array(array('row' => 'HtmlTag'), array('tag' => 'li')),
);
推薦答案
您需要在 Zend_Form_Element_Radio 對象上調用 setSeparator 方法,并傳遞它 ''.這是此處的示例:
You need to call the setSeparator method on the Zend_Form_Element_Radio object, passing it ''. Here's an example from here:
<?php
class CustomForm extends Zend_Form
{
public function init()
{
$this->setMethod('post');
$this->setAction('user/process');
$gender = new Zend_Form_Element_Radio('gender');
$gender->setLabel('Gender:')
->addMultiOptions(array(
'male' => 'Male',
'female' => 'Female'
))
->setSeparator('');
}
}
這篇關于在一行上顯示 Zend_Form_Element_Radio的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!