Friday, May 24, 2013

$this->Modelname->validator()->add(); works, but shows no messages in view

Hi,

I have a difficult situation, I am on my way with the validation, but now I'm stuck. I'll try to briefly explain my situation before asking my question.

We have one controller called "websitemodules", it has no model because it uses different tables, I make the model in the view with the new Appmodel. Example: websitemodules gets a variable, "newsitems", this is the database table we want to use and therefore I make a temporary model for this newsitems so that I can use CakePHP ways of getting data etc. The variable can change, for example it can also be blogs, or products, etc. This works good. 

I have now added validation to it in the controller with the $this->$slug->validator()->add(); where $slug is for example newsitems. I've left the rules out of it to simplefy things. This works, because when I try to save my data, I get the right error messages all in one debug.

My question now is: I don't want them in one debug or later in one message to the user. I want them in the cake way to show under the field it belongs to, and the * after the label. I just don't know how to get that or what I am doing wrong.

I hope all is clear, if there are any questions I will try to make things more clear.

Thanks!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: