My scenario is :

Keep for example there is a view file and it has 2 input fields for
entering name.
First field belong to model_1 which is the primary model of the view
page.
Second field belongs to another model model_2.
Both fields are mandatory and has an error msg. if left blank.

If I use $this->model->invalidFields() in my controller, I am getting
the errors as an array. --> No issues here.

But when I try to use $form->error(...) function, errors get displayed
for the first field which belongs to the primary model but for the
second field though I leave it blank no error msg. are getting
displayed.

I understand we have to tell cakePHP that second field belongs to
another model, So I declared it in following way:

echo $form->input('model_2.NAME', array('class' => 'input_edit'));
echo $form->error('model_2.NAME', 'error msg');

What is wrong with the above? Am I not addressing something here?
Please help me to solve this issue.
--~--~---------~--~----~------------~-------~--~----~
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