Greetings,
I am attempting to validate data before a save in the controller
$this-data['Order']['orderid'] = 'ecommerceorderid#'
$this-Order-set($this-data);
$this-Order-validates();
-
I manually set $this-data['Order']['orderid'] to a value that is
already present in the database
If you set the value of id in your data array Cake assumes you are doing an
update rather than an insert, so it might well be true that it validates.
Sounds like you need to pull a set of ids from the database and remove them
from the data array before attempting your save.
Jeremy Burns
Class
can you post your validation rules here?
On 21 Jun., 18:13, Josey josey.mor...@gmail.com wrote:
Greetings,
I am attempting to validate data before a save in the controller
$this-data['Order']['orderid'] = 'ecommerceorderid#'
$this-Order-set($this-data);
$this-Order-validates();
It is not the id field of the table, its another field called orderid.
I kindof though I would have to do a find as well just wanted to avoid
as its just that many extra calls to the database.
On Jun 21, 11:18 am, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
If you set the
Absolutely,
The model validation variable is as follows:
var $validate = array(
'orderid' = 'isUnique'
);
On Jun 21, 11:19 am, euromark dereurom...@googlemail.com wrote:
can you post your validation rules here?
On 21 Jun., 18:13, Josey josey.mor...@gmail.com
thats not how a valid cake1.3 validation structure should look like
see the manual:
http://book.cakephp.org/view/125/Data-Validation
On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:
Absolutely,
The model validation variable is as follows:
var $validate = array(
I am developing in 1.2.7
On Jun 21, 4:47 pm, euromark dereurom...@googlemail.com wrote:
thats not how a valid cake1.3 validation structure should look like
see the manual:http://book.cakephp.org/view/125/Data-Validation
On 21 Jun., 19:12, Josey josey.mor...@gmail.com wrote:
Absolutely,
Mark,
I changed the formatting of the validation based on the link you
provided and it seems to be working now. Many thanks!
On Jun 21, 4:47 pm, euromark dereurom...@googlemail.com wrote:
thats not how a valid cake1.3 validation structure should look like
see the
I was wrong, I had an extra rule causing data to get flagged. Once I
removed that all orders go thru, even invalid ones.
var $validate = array(
'orderid' = array(
'isUnique' = array(
'rule' = 'isUnique',
'required' = true,
that is indeed very strange
the array now looks ok...
On 22 Jun., 00:06, Josey josey.mor...@gmail.com wrote:
I was wrong, I had an extra rule causing data to get flagged. Once I
removed that all orders go thru, even invalid ones.
var $validate = array(
'orderid' =
I will keep tinkering, thank you for your help.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to
11 matches
Mail list logo