【发布时间】:2014-03-18 10:02:34
【问题描述】:
Moin Moin,你好,
我是 Zend 框架的新手,所以我希望我的问题对你来说不是什么大问题。
我正在使用 Zend Framework 1.12.5 和 jQuery Mobile 1.4.0。
我想做的是在我的注册表单中添加两个水平单选按钮。在阅读了 jQuery 文档后,我发现您需要将单选按钮添加到属性为“data-type="horizontal"”的字段集中。但我不知道如何在框架中做到这一点。
至少我想要这样的东西:
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Gender</legend>
<input name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked" type="radio">
<label for="radio-choice-h-2a">male</label>
<input name="radio-choice-h-2" id="radio-choice-h-2b" value="off" type="radio">
<label for="radio-choice-h-2b">female</label>
</fieldset>
这是我的 Zend-form 的代码:
$this->addElement('radio', 'gender', array(
'label'=>'Gender',
'value' => '0',
'multiOptions'=>array(
'0' => 'male',
'1' => 'female',
),
'separator' => ' ',
'decorators' => array(
'ViewHelper',
)
));
我尝试为字段集创建一个自己的表单元素并在其中包含单选按钮,但字段集是同时创建和关闭的。 (如果你愿意,我也可以发布源代码。) 所以我的 HTML 看起来像这样:
<form id="register" enctype="application/x-www-form-urlencoded" method="post" autocomplete="off" action=""><div class="form">
<fieldset data-role="controlgroup" data-type="horizontal"></fieldset>
<dt id="gender-label"><label class="optional">Gender</label></dt>
<label><input type="radio" name="gender" ...
如您所见:它不起作用。
有没有人也遇到过这个问题,可以给我推动正确的方向?
感谢您的帮助。
巴兹提
【问题讨论】:
标签: jquery-mobile zend-framework radio-button zend-form fieldset