Iam使用以下代码来生成验证码:
$captcha = $this->createElement('captcha', 'captcha',
array('required' => true,
'captcha' => array('captcha' => 'Image',
'font' => 'resource/fonts/arial.ttf',
'fontSize' => '24',
'wordLen' => '5',
'height' => '50',
'width' => '150',
'imgDir' => 'resource/captcha',
'imgUrl' => 'resource/captcha',
'gcFreq'=>'10',
'dotNoiseLevel' => '10',
'lineNoiseLevel' => '2')));
$captcha->setLabel('Captcha');将生成以下代码:
<label for="captcha-input" class="login_label required">Captcha</label>
<img width="150" height="50" alt="" src="captcha/eb3a592c8b1c7a71b0c7ce5179422be2.png" />
<input type="hidden" name="captcha[id]" value="eb3a592c8b1c7a71b0c7ce5179422be2" id="captcha-id">
<input type="text" name="captcha[input]" id="captcha-input" value="">
<input type="text" name="captcha" id="captcha" value="eb3a592c8b1c7a71b0c7ce5179422be2">是否有人可以指导我如何删除额外的输入文本字段,如
<input type="text" name="captcha" id="captcha" value="eb3a592c8b1c7a71b0c7ce5179422be2">提前感谢
发布于 2012-07-05 21:52:32
重要的是要做好
$this->getElement('captcha')->removeDecorator("viewhelper");在之后,您已经启用了ElementsDecorators (它首先设置ViewHelper -不要删除它,它无论如何都是必需的)
对我来说,它看起来像这样:
$this->setElementDecorators(array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
$this->getElement('captcha')->removeDecorator("viewhelper");发布于 2011-07-23 18:16:29
这种输入不是“额外的”--它是必不可少的。
验证CAPTCHA时,将使用该字段的值查找CAPTCHA的正确解决方案,然后将其与用户输入进行比较。
没有这个字段,验证码就会崩溃。
为什么你一开始就想删除它呢?
发布于 2011-11-01 00:34:22
您可以尝试这样做:
$this->getElement('captcha')->removeDecorator("viewhelper");https://stackoverflow.com/questions/6799704
复制相似问题