You do not need the Model name in the validate. Just the fieldname
If Applicant is the model and age the field
Applicant Model:
'age' => array(
'required' => true,
'rule' => 'numeric',
'message' => 'Please enter a valid age.'
),
Give that a try
Dave
From: OldWest [mailto:[email protected]]
Sent: Wednesday, February 02, 2011 6:20 PM
To: [email protected]
Subject: Validating Search form Submission Field (no field in database
table) ?
I've been at this for about 3 hours now. I cannot get validation working on
my search form. My search form is working fine.
Here is my form field (which is the views/plans) of the Plan model.
echo $this->Form->input('ApplicantAge', array('label'=>'Applicant Age',
'type'=>'text'));
Here is my Plan model validation:
...
'ApplicantAge' => array(
'required' => true,
'rule' => 'numeric',
'message' => 'Please enter a valid age.'
),
...
When I have the model data defined as above the astricks * shows up next to
my search for field as expected, but when I submit with a blank field or
non-numeric entry, no validation message displays?
Does anyone know why this is not working? The Manual does not explain this
about search forms and non-field validation, and I could not find any
working example son Google, so a bit lost.
Thanks for any advice : )
--
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
--
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