On Dec 20, 8:10 pm, Rob Wilkerson <[email protected]> wrote:
> On Dec 20, 7:58 pm, Rob Wilkerson <[email protected]> wrote:
>
> > If I were to simplify this example and simple ask that the login field
> > be required, how would I do that?
>
> Do I really need the 'rule' key _and_ the 'allowEmpty' key? Would it
> suffice to remove the 'rule' key and just retain 'required' and
> 'allowEmpty'?
And, as a follow up, what do I need to do to get the "required" class
to appear? I set up my Address model with the following complete
validation:
public $validate = array (
'street_address_1' => array (
'rule' => 'notEmpty',
'required' => true,
'allowEmpty' => false,
'message' => 'Street address is required'
),
'city' => array (
'rule' => 'notEmpty',
'required' => true,
'allowEmpty' => false,
'message' => 'City is required'
),
'state_id' => array (
'rule' => 'notEmpty',
'required' => true,
'allowEmpty' => false,
'message' => 'State is required'
),
'zip_code' => array (
'rule' => array ( 'postal', null, 'us' ),
'required' => true,
'allowEmpty' => false,
'message' => 'Expected a 5 digit U.S. zip code'
)
);
I see the "required" class when I access /addresses/add, but not when
I'm entering an address through another model. I have a Vendor that
belongsTo an Address. I'm using the form on vendors/add where I've
created a form with fields named Address.city, Address.zip_code, etc.
Am I missing something?
Sorry about all of the variations on the same question. Being new, I'm
trying to sort out a lot of things at once. :-)
Thanks again.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---