When you put it like that its so easy to understand. I read the
cookbook but your example is 100 times better and clearly explained
when you lay it out like that. thank you very much. that looks like
exactly what I need.

Good looking out!

Thanks,

Dave

On Nov 23, 1:29 am, Amit <a...@amitvaria.com> wrote:
> Take a look at the CakeBook 
> -http://book.cakephp.org/view/127/One-Rule-Per-Field
>
> var $validate = array(
>     'email' => array(
>         'rule' => array('email', 'isUnique'),
>         'required' => true,
>         'allowEmpty' => false,
>         'on' => 'create',
>         'message' => 'Your Error Message'
>     ),
>     'email' => array(
>         'rule' => array('email', 'isUnique'),
>         'allowEmpty' => false,
>         'on' => 'update',
>         'message' => 'Your Error Message'
>     ),
>     'url' => array(
>         'rule' => array('url', 'isUnique'),
>         'required' => true,
>         'allowEmpty' => false,
>         'on' => 'create',
>         'message' => 'Your Error Message'
>     ),
>     'url' => array(
>         'rule' => array('url', 'isUnique'),
>         'allowEmpty' => false,
>         'on' => 'update',
>         'message' => 'Your Error Message'
>     ),
>
> );
>
> On Nov 22, 8:45 pm, Dave <make.cake.b...@gmail.com> wrote:
>
> > I cant figure out how to do this.
> > I have 2  fields, an email and a url, both are required and need to be
> > unique when a user wants to update thier info.
>
> > If the user is only updating 1 field the other required will fail
> > because its required. If they enter in the email field their current
> > email because it says required it will come back invalid because its
> > no longer unique. Vice versa for the url.
>
> > They may only want to change one of the 2 fields information but how
> > can you get around this? I dont want them entering in anything thats
> > not valid for email / url so i need the validation rules. They are
> > both required but how can they edit just 1 field?
>
> > Thanks,
>
> > Dave
>
>

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@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=.


Reply via email to