在 QuickForm 中,它可以像这样完成:
$form = new HTML_QuickForm2('changepassword');
$passwordold = $fs->addElement('password', 'oldpassword')->setLabel('Old password');
function chkPass($fields)
{
if ((strlen($fields['oldpassword']) && (md5($fields['oldpassword'])<>passwordcheck())))
{
return array('oldpassword' => 'Old password does not match your records.');
}
return true;
}
$form->addFormRule('chkPass');
但是QuickForm2好像没有addFormRule(),有什么可以替代的吗?