On Jan 24, 11:08 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> Ran into this seemingly simple problem which I have not been able to solve :(
>
> I have User model which hasOne Profile model
>
> The users/add view has fields for both User and Profile with
> corresponding tagErrorMsg like
> $html->tagErrorMsg("Users/username") and
> $html->tagErrorMsg("Profile/fullname") etc
>
> In the users_controller - add action - I do
>
> $user_validates = $this->User->validates();
>
> $profile_validates = $this->User->Profile->validates();
>
> Subsequently I test if both are true and do the needful to save both
> models. (setting user_id in profile after saving user and the works)
>
> - If the all data is valid saving works.
> - If the User data is not valid I see error messages rendered via tagErrorMsg
> - BUT if Profile data is not valid no error messages are rendered.
>
> What would be the simplest way to solve this?
>
> In other words how to get tagErrorMsg to render validationErrors from
> an associated hasOne model with minimal coding and what would be the
> correct cakePHP way to do it.
>
> Thanks in advance
>
> Tarique
>
> --
> =============================================================
> PHP for E-Biz:http://sanisoft.com
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> =============================================================
Did you try
$user_validates = $this->User->validates($this->data);
$profile_validates = $this->User->Profile->validates($this->data);
HTH,
AD7six
Please note:
The manual/bakery is a good place to start any quest for info.
The cake search (at the time of writing) erroneously reports less/no
results for the google group.
The wiki may contain incorrect info - read at your own risk (it's
mainly user submitted) :) You may get your answer quicker by asking on
the IRC Channel (you can access it with just a browser
here:http://irc.cakephp.org).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---