text
autocomplete
password
textarea
hidden
select
hierselect
hiddenselect
checkbox
radio
submit
reset
button
image
file
advcheckbox
date
static
header
link
html
其中compare规则有点特殊,它是指两个表单的输入数据必须相同(如密码确认时)。它的用法如下:
$form->addElement('password','password_1','Enter your password:');
$form->addElement('password','password_2','Enter your password (again):');
$form->addRule(array('password_1','password_2'),
"Passwords don't match!",'compare');
compare也可以用来比较两个表单中输入的数据的大小,如:
$form->addElement('text','min_age','Minimum Age:');
$form->addElement('text','max_age','Maximum Age:');
$form->addRule(array('min_age','max_age'),
"Minimum Age must be less than Maximum Age",
'compare',');