-
Notifications
You must be signed in to change notification settings - Fork 2
Functionality
barbir edited this page Sep 14, 2010
·
1 revision
The idea of JQValidator is to have a data validation defined in CakePHP models prior to sending the information to the server. This has many advantages, reducing the number of server requests, making the work faster are just some of them.
After defining the validation in your model like so:
var $validate = array
(
'notemptyfield' => array
(
'notempty' => array
(
'rule' => array('notempty'),
'message' => 'Validation message #1',
),
),
'numericfield' => array
(
'numeric' => array
(
'rule' => array('numeric'),
'message' => 'Validation message #2',
),
),
'datefield' => array
(
'date' => array
(
'rule' => array('date'),
'message' => 'Validation message #3',
),
),
);And using the plugin like in the usage page. You will recieve a nice (actually ugly by my opinon) alert dialog notifying you of all errors in your input.
Currently supported datatypes for CakePHP client-side validation are:
- notempty
- numeric
- date
That’s all for now, feel free to use this plugin and enhance it, I appretiate all the help.