Re: Model Validation -> 'blank' rule triggered without beeing set
Thanks :) @ > btw, your TRUE shouldn't be enclosed in an array, it should be " > 'required' => true ". well, i got confused by the warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash when i dont had the "required" setting in an array, so i pushed it into one, and the error disappeard (but i guess the setting didn't work then). But now i got it, the warning disappeared after adding the rule. Everythings fine now, thx :) On 13 Nov., 10:59, Rafael Bandeira aka rafaelbandeira3 <[EMAIL PROTECTED]> wrote: > > triggered? And how can i avoid it without changing the cakecore? > > set the 'rule' key on $validate for each field, and specify the rule > you want it to follow, when a validation > scheme is set on $validate but no rule is specified, the 'blank' rule > is assumed. > Please refer to the cookbook for more information on validation, we > got lots of information there. > btw, your TRUE shouldn't be enclosed in an array, it should be " > 'required' => true ". > > > $this->exists(); > > What effect does this call have in this context? As far as i see, the > > call returns a boolean to the void o_O ? > > Model::exists() caches the returned value in a private var - Model:: > $__exists - and that's the used in the rest of the method to test the > record existence. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model Validation -> 'blank' rule triggered without beeing set
> triggered? And how can i avoid it without changing the cakecore? set the 'rule' key on $validate for each field, and specify the rule you want it to follow, when a validation scheme is set on $validate but no rule is specified, the 'blank' rule is assumed. Please refer to the cookbook for more information on validation, we got lots of information there. btw, your TRUE shouldn't be enclosed in an array, it should be " 'required' => true ". > $this->exists(); > What effect does this call have in this context? As far as i see, the > call returns a boolean to the void o_O ? Model::exists() caches the returned value in a private var - Model:: $__exists - and that's the used in the rest of the method to test the record existence. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Model Validation -> 'blank' rule triggered without beeing set
Hi guys, I've a confusing problem here: my model: -- class MenuStructure extends AppModel { var $validate = array('root_struct_id' => array('required' => array (true)), 'parent_struct_id' => array('required' => array(true)), 'struct_id' => array('required' => array(true)), 'file_name' => array('required' => array(true)) ); } -- in the controller i call: if ($this->RequestHandler->isPost()) { $this->MenuStructure->create($this->data); if ($this->MenuStructure->validates() && $this->AnotherModelBla- >validates()) { $this->MenuStructure->save($this->data); } } - $this->data: Array ( [MenuStructure] => Array ( [root_struct_id] => 1 [struct_id] => 4 [parent_struct_id] => 1 [navi_level] => 1 [file_name] => fghf.test ) [AnotherModelBla] => Array ( [... some stuff here ...] ) ) after spending some time i found out that MenuStructure fails to validate... As you can see, all required fields for MenuStructure are set...after some debugging in cakes core i found that the 'blank' rule is triggered on MenuStructure->validates() and, of course, fails, as the fields are not blank...so, the question is: why does is the blank-rule triggered? And how can i avoid it without changing the cakecore? and btw: in cake/libes/model/model.php, line 2151 (RC2), line 2202 (RC3): $this->exists(); What effect does this call have in this context? As far as i see, the call returns a boolean to the void o_O ? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---