I need to create a validation to textfield only allow me to enter text no number and no symbols. text only.
Asked
Active
Viewed 825 times
1 Answers
1
with the following rule, where attribute is the name of the textfield
array('attribute', 'match', 'pattern'=>'/^[a-zA-Z]+$/'),
Check out this link to see all build in validation options: http://www.yiiframework.com/wiki/56/

Samuel Liew
- 76,741
- 107
- 159
- 260

Alfred_P
- 792
- 4
- 8
-
I worked perfect. It only agrege the symbol "+" array ('attribute', 'match', 'pattern' => '/ ^ [a-zA-Z] + $ /'), – josterricardo Oct 03 '14 at 15:28
-
If you want to enter such spaces to place both names, so you can use it: array('nombres, apellidos', 'match', 'pattern'=>'/^[a-zA-Z[:space:]]+$/'), – josterricardo Oct 08 '14 at 20:09