> For my catalog form I would like to use the same model, just need to
> validate also the fields: street, postcode, city and country.
>
If validation rule doesn't contain 'required' => true, then it is not
processed, if proper field (key) doesn't exist in model's data. It means -
just with following validation rules
public $validate = array(
'street' => array(
'rule' => array('minLength', 4),
'message' => 'At least %s characters required',
),
'postcode' => array(
'rule' => array('postal', null, 'us'),
'message' => 'Invalid postal code',
),
'city' => array(
'rule' => array('minLength', 2),
'message' => 'At least %s characters required',
),
);
and 2 contact/add forms (one with these 3 fields, one without them),
everything should work as you expect. My previous solution makes sense only
if one wants to allow store empty (optional) values.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php