I mean when I hit submit the form gets sent and comes back invalid but
nothing is marked as invalid (even when I leave it completely empty). Then
same page without refreshing or anything just hit submit on that same
returned form it comes back with errors. Even if I have letters / numbers in
the field it says Can not be empty.

Just weird.

Dave 

-----Original Message-----
From: WebbedIT [mailto:p...@webbedit.co.uk] 
Sent: October-19-09 5:08 AM
To: CakePHP
Subject: Re: Help with validation


Firstly, you are trying very simple validation so there must be something
very simple wrong with it that's easily fixed when identified. Have you got
validation working anywhere else in your app?

When you say hit submit and nothing do you mean it shows the form again and
is this because it has failed to validate?

You maybe want to echo $this->validationErrors in your view to see what
errors you are getting, it may be that you are getting the errors but
something is up with the form field naming that is stopping the automagic
working.

In my controllers I personally go for the following approach rather than
validating first as save does that for you.

if($this->Model->save($this->data)) {
  // Validated and saved, save a flash message and redirect to desired page
} else {
  // Failed, show form again with errors }



--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to