how do I validate *only if value is present*

2007-11-28 Thread Luke

I have a model called Orders that I need to validate. In this model,
there is a fax number that is not required, but if submitted must be
in the format of a phone number. I cannot seem to figure out how to do
something like this in cake. It seems to me that it should be
something as easy as

var $validate = array(
  'shipping_fax' = array('required' = false, 'rule' =
'validatePhone')
)

am I going about it wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: how do I validate *only if value is present*

2007-11-28 Thread francky06l

add 'allowEmpty' = true

On Nov 28, 6:52 pm, Luke [EMAIL PROTECTED] wrote:
 I have a model called Orders that I need to validate. In this model,
 there is a fax number that is not required, but if submitted must be
 in the format of a phone number. I cannot seem to figure out how to do
 something like this in cake. It seems to me that it should be
 something as easy as

 var $validate = array(
   'shipping_fax' = array('required' = false, 'rule' =
 'validatePhone')
 )

 am I going about it wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---