我在我的zend_form中使用验证码。
$captcha_element = new Zend_Form_Element_Captcha(
'captcha',
array('label' => 'Write the chars to the field',
'captcha' => array(
'captcha' => 'Image',
'wordLen' => 6,
'timeout' => 300,
'font' => DOC_ROOT . '/data/fonts/Vera.ttf',
'imgDir' => $imagedir,
'imgUrl' => $umageurl
)
)
);
这将生成:
<dt id="captcha-input-label">
<label for="captcha-input" class="required">Write the chars to the field</label>
</dt>
<dd id="captcha-element">
<img width="200" height="50" alt="" src="http://sitename.com/captcha/09dd951939c6cdf7fa28f2b7d322ea95.png">
<input type="hidden" name="captcha[id]" value="09dd951939c6cdf7fa28f2b7d322ea95" id="captcha-id">
<input type="text" name="captcha[input]" id="captcha-input" value="">
</dd>
然而,我需要以下内容(验证码元素被单独包装在某些标签中):
<dt id="captcha-input-label">
<label for="captcha-input" class="required">Write the chars to the field</label>
</dt>
<dd id="captcha-element">
<div><span>
<input type="text" name="captcha[input]" id="captcha-input" value="">
</span></div>
<div><span>
<img width="200" height="50" alt="" src="http://sitename.com/captcha/09dd951939c6cdf7fa28f2b7d322ea95.png">
<input type="hidden" name="captcha[id]" value="09dd951939c6cdf7fa28f2b7d322ea95" id="captcha-id">
</span></div>
</dd>
我无法想出如何做到这一点。我能通过使用自定义装饰器来实现吗?或者需要使用自定义验证码?