Sorry about that.  I am never sure how much to include!

Following is the action the form posts to.  I have validation rules in
both the Agency model and the Member model.
But the validation errors from the member model don't show up on a
failure. Only the agency errors show and not all of those.

What I have here doesn't seem very DRY to me, but usually once I get
it working I can clean it up.
Another issue I noted was that I have to explicitly remove the agency
data if the member save doesn't work.  Seems like it should be tied
together more tightly.

I am currently trying the saveAll you suggested.
Thanks for any suggestions!

Jee
=====================================================================================================================
<?php
class AgenciesController extends AppController {

  var $name = 'Agencies';
  var $helpers = array('Html', 'Form');
  var $uses = array('Agency', 'Member');

        function signup() {
                if (!empty($this->data)) {
                $this->Agency->Member->validate($this->data["Member"]);
                $this->Agency->validate($this->data["Agency"]);
                          $this->Agency->Member->create();
                          $this->Agency->create();
                        if ($this->Agency->save($this->data["Agency"])) :
                  if ($this->Agency->Member->save($this->data["Member"])) :
                                $this->Session->setFlash(__('Thank you for 
joining us!  Your
new account has been saved', true));
                                
$this->redirect(array('url'=>'/files/signup.pdf'));
                        else :
                          $this->Agency->remove();
                                  $this->Session->setFlash(__('We are sorry but 
your new account
could not be saved. Please, check the Contact Details for errors and
try again.', true));
                          endif;
                        else :
                                $this->Session->setFlash(__('We are sorry but 
your new account
could not be saved. Please, check the Agency Details for errors and
try again.', true));
                        endif;
                }
                $referrals = $this->Agency->Referral->find('list');
                $this->set(compact('referrals'));
  }
}
?>
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to