On 18/11/2009, at 12:07 PM, Jas wrote:

> Is it possible when using isUnique Validation to return the id of the
> existing field, so that it can be used instead of asking the user to
> create something unique?
> 
> --
> 
> 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=.
> 
> 


Sounds like you want to edit, if the user enters in the same ID as an existing 
entry.
This is a somewhat special case.

1) Disable your validation. At the moment its operating like an add, since 
there is no ID in the form submission and your isUnique is screwing things up.
2) You are going to have to do some in-controller processing to deal with the 
data submitted:

- Check the ID supplied
- if it exists, load the data, overwrite with supplied data, and save
- if it didnt exist, save new record.

I would be ensuring validation on the fields you need with the exception of the 
ID.

Cheers,

Graham Weldon
e. [email protected]
p. +61 407 017 293
w. http://grahamweldon.com

--

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=.


Reply via email to