OK - frustration over. I cleared the cache and ran it again, and all works as expected. Very bizarre though, considering I started with an empty cache and have cleared it many times during this debug process.
Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote: > Thanks. Here's my findings from the test site. > > get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', so > the model is loaded. > > I have littered debug statements throughout and the code is not erroring > before or after the saves; the saves are happening and failing, producing > validation errors. > > I have created a variable ($validationErrors) and added the validationErrors > as they occur (so at one point the array looks like > $validationErrors['OrderAddress']['field_name'] => 'message'). > > I have added some debug statements before the form is rendered: > > - debug($this->validationErrors); => empty > > - debug($this->Order->OrderItem->OrderAddress->validationErrors); => array of > fields and messages as expected > > - debug($validationErrors); => array of fields and messages as expected > > Using the debug toolbar, I can see the variable $this->validationErrors, > which is empty. > > I have also passed $validationErrors as a variable, which is populated as > expected. > > So whilst I can see that validation is failing and errors are being recorded, > they are not being displayed at the front end. > > Here's the thing. This is exactly the same code as is running on my Mac. On > my Mac using the debug toolbar I can see the variable $this->validationErrors > has keys for each model that has validation errors (e.g. ['OrderAddress']). > > So I'm still stumped. > > I have tried to append items to $this->validationErrors, but none of them > have any effect. > > For additional information, here's how I am constructing my form and the > inputs: > > I have tried all sorts of varieties and each produces the same result: > echo $this->Form->create(array('class' => 'order-form')); /*this is the > currently deployed option */ > echo $this->Form->create('Order', array('class' => 'order-form')); > echo $this->Form->create('Order', array('action' => 'your_details', 'class' > => 'order-form')); > echo $this->Form->create('OrderAddress', array('url' => 'your_details', > 'class' => 'order-form')); > > Inputs are fairly standard: echo $this->Form->input('OrderAddress.address1'); > > Jeremy Burns > Class Outfit > > [email protected] > http://www.classoutfit.com > > On 17 Sep 2010, at 03:46, Dr. Loboto wrote: > >> Output get_class($this->MyModelThatDontValidate) or call custom model >> method to check that models are really loaded. Also check that you >> approach save() or validates() call in controller and don't get error >> before that abandon save/validation. Be sure that debug > 0. In most >> of cases such errors have true silly reason and 0.1% is for buggy >> software combination on target server. >> >> On Sep 17, 12:33 am, Jeremy Burns | Class Outfit >> <[email protected]> wrote: >>> Nope, not correct. All models named correctly - and don't forget exactly >>> this same code works on my Mac. If your theory was right then I'd be >>> getting all sorts of errors and the forms wouldn't pull any data at all. In >>> my case, $this->validationErrors is empty. >>> >>> Jeremy Burns >>> Class Outfit >>> >>> [email protected] >>> (t) +44 (0) 208 123 3822 >>> (m) +44 (0) 7973 481949 >>> Skype: jeremy_burnshttp://www.classoutfit.com >>> >>> On 16 Sep 2010, at 18:30, Dr. Loboto wrote: >>> >>> >>> >>>> 99.9% - your models are not loaded at all because you named them not >>>> in lowercase. >>> >>>> On 16 сен, 20:52, Jeremy Burns <[email protected]> wrote: >>>>> I'm a bit stumped. I've developed some code on my local machine (MAMP) >>>>> and when a form fails validation I get the right error messages >>>>> displayed in the right places. I have used the form helper to create >>>>> the form and the inputs, but have not used any code to produce the >>>>> error messages - I am leaving that to Cake's magic. >>> >>>>> I have moved the site lock, stock and barrel to a remote test server, >>>>> and - boom - no error messages. >>> >>>>> Anyone got any pointers about why this might happen, and what are the >>>>> golden rules to ensure that Cake waves its magic wand appropriately? >>> >>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] For more options, visit this group >>>> athttp://groups.google.com/group/cake-php?hl=en >> >> 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 [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=en > > 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 [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=en 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 [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=en
