Yeah it works now. Thanks for the help.

I was using a component that allowed me to validate the data in a
different controller and display the errors in a different view using
a session. That's what was messing things up. It worked once I stopped
using the component.

On Nov 29, 4:31 pm, francky06l <[EMAIL PROTECTED]> wrote:
> $this->Model->validationErrors  works for me and contains the
> errors .... Something is wrong...
>
> On Nov 29, 10:21 pm, Action <[EMAIL PROTECTED]> wrote:
>
> > Nevermind, it works now.
>
> > On Nov 29, 4:10 pm, Action <[EMAIL PROTECTED]> wrote:
>
> > > I tried your method but $this->Model->validationErrors just returns an
> > > empty array...even if there are errors.
>
> > > Controller:
>
> > > $this->set('haserrors', $this->Comment->validationErrors);
>
> > > View:
>
> > > print_r($haserrors);
>
> > > On Nov 29, 3:47 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > You can use $this->Model->validationErrors that will contain fields in
> > > > error.
> > > > I also something like this with Ajax, actually I set this array to my
> > > > view, and I use the array to insert some "message" into the Dom..
>
> > > > In controller :
>
> > > > if(!$this->model->save())
> > > > {
> > > >    $this->set('haserrors',  $this->Model->validationErrors );
>
> > > > }
>
> > > > In the view:
>
> > > >        foreach($haserrors as $key => $val)
> > > >         {
> > > >             $v = 
> > > > Inflector::camelize(Inflector::singularize($this->name)).Inflector::camelize($key);
>
> > > >             // $v will be the Id generated of the field , the one
> > > > generated by $form->input .. Usually ModelField
>
> > > >             // ... js code to insert message (message is in $val) ..
> > > >        }
>
> > > > Hope this helps
>
> > > > On Nov 29, 9:33 pm, Action <[EMAIL PROTECTED]> wrote:
>
> > > > > That's pretty much how it's been every step of the way. As powerful as
> > > > > this framework is, it's becoming too much of a pain in the ass to
> > > > > figure out how to do things with out proper documentation...thus
> > > > > defeating the originally purpose of a framework: speeding up
> > > > > development. I've been toying with the idea of switching to
> > > > > Codeigniter for some time now. I'm wondering trading some power for
> > > > > better docs would ultimately speed things up.
>
> > > > > On Nov 29, 3:28 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > > > > > On Nov 29, 2007 3:21 PM, Action <[EMAIL PROTECTED]> wrote:
>
> > > > > > > That doesn't help. I know how to set validation rules in errors. 
> > > > > > > My
> > > > > > > question is, how do I manually output those errors when a field
> > > > > > > invalidates? For example, if the username field invalidates, what
> > > > > > > variable stores the error message I defined in model so that I can
> > > > > > > manually output it in the view? I want to know if there is 
> > > > > > > something
> > > > > > > like an invalid fields array that is created each time a form
> > > > > > > validates?
>
> > > > > > Ah, I understand what you're getting at.  Well, validation seems to 
> > > > > > be
> > > > > > very tied into the form helper itself, so you may have to 'roll your
> > > > > > own' to get what you need.  I've never done anything like that, but
> > > > > > people on this list probably have and some of the Elder Gods of
> > > > > > CakePHP can probably tell you how you might be able to go and do it.
>
> > > > > > --
> > > > > > Chris Hartjes
>
> > > > > > My motto for 2007:  "Just build it, damnit!"
>
> > > > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to