Re: get action in beforeValidate?

2009-04-20 Thread brian

Yes, this is the way i decided to do it.

On Sun, Apr 19, 2009 at 4:31 PM, burzum bur...@doomzone.de wrote:

 If you need any special validation for a method put it in a model
 method and just pass $this-data + whatever you need to this method.
 The model method can then set or unset() whatever conditions you need
 for validation and process it the data in this method. Remember: Fat
 models tiny controllers.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: get action in beforeValidate?

2009-04-19 Thread burzum

If you need any special validation for a method put it in a model
method and just pass $this-data + whatever you need to this method.
The model method can then set or unset() whatever conditions you need
for validation and process it the data in this method. Remember: Fat
models tiny controllers.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: get action in beforeValidate?

2009-04-18 Thread brian

OK, I just came across a link to the on info in the cookbook (that
table of contents needs an overhaul) but it looks like it only works
with single rules per field. Bummer.

And GreyCells gives the lowdown on the options array here:

http://teknoid.wordpress.com/2008/09/22/setmerge-and-dynamic-validation-rules/

I'm still wondering if I can get the current action in
beforeValidate() though. Otherwise, I guess I have to pass something
in the options from the controller.

On Sat, Apr 18, 2009 at 2:47 PM, brian bally.z...@gmail.com wrote:
 I've been hunting around for the best way to have action-based
 validation. I know there's an on key that may be used but I can't
 find anything online about how to use it properly. Anyone know where
 it's documented?

 I came across this thread, linked from the FAQ:

 http://groups.google.com/group/cake-php/browse_frm/thread/e2e840434c733cfa/0d03101191f5674a

 I like the method worked out by keymaster but left unsaid is how to
 know what the present action is. Nothing in the source jumps out at
 me.

 Also, I'm curious about beforeValidate() options param. Once again, a
 mysterious options array is available with nary a word on using it.
 :-(

 ps: note that keymaster's beforeValidate() is missing the return boolean.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: get action in beforeValidate?

2009-04-18 Thread Miles J

By current action, do you mean the controllers action thats calling
the validation?

Ive looked and tried before, theres no way to do it unless you hack it
up yourself.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: get action in beforeValidate?

2009-04-18 Thread brian

Yes, that's what I meant. After poking around in the source for awhile
I agree that it doesn't look possible.

On Sat, Apr 18, 2009 at 3:55 PM, Miles J mileswjohn...@gmail.com wrote:

 By current action, do you mean the controllers action thats calling
 the validation?

 Ive looked and tried before, theres no way to do it unless you hack it
 up yourself.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---