-2

我正在使用联系表格,我真的需要这个。我向开发人员发送了消息,但我不能再等了...

我尝试了很多方法来使它工作,但总是失败。无论我做什么,都不是有效答案,或者只有第一个或只有最后一个......所以请php程序员帮我解决这个问题。

$custom = new Quform_Element('custom_answer', 'Custom answer');
$custom->addFilter('trim');
$custom->addValidator('required');
$custom->addValidator('identical', array(
'token' => 'im-a-test',
'messages' => array(
'not_match' => 'Invalid Answer. Please try again!'
)
));
$custom->setIsHidden(true);
$form->addElement($custom);

基本上它就像自定义验证器字段。所以有一种形式,人们可以输入一些东西......如何做出多个相同的有效答案?im-a-test 有效,但如何添加 im-a-test2 等等...我想要 20 个正确答案。

如果有人可以帮助我,我真的很感激。提前致谢。

4

1 回答 1

1

看起来 Quform_Element 是基于 Zend_Form_Element 的。如果是,并且 Zend Framework 的其余部分在那里,那么这可能会起作用:

$custom->addValidator(new Zend_Validate_InArray(array('im-a-test', 'im-a-test-2')));
于 2012-05-30T19:14:38.923 回答