Thank you very much for your reply, I have been reading it closely and
try to apply it to my work, however I have found myself stuck in the
same rut.

My problem is really very simply but I've tried everything and can get
a solution. All I need is to populate a field in my appointments form
with the id from the enquiries table then insert the data in to
appointments
.
Appoinment $belongTo Enquiry and Enquiry $hasOne Appointment. I know
the associations are OK as I can view the enquiry and relevent
appointment together.

I have my appointments_controller..
var $name='Appointments';

     function add()
      {
         $this->set('data', $this->Appointment->Enquiry->find());

         if(empty($this->params['data']))
         {
            $this->render();
         }
         else...

and add.thtml
  <p>Enquiry ID: <?php echo $data['Enquiry']['id']; ?></p>
 //simply trying to keep it to display at the moment.
  Appointment ID: <?php echo $html->input('Appointment/id'); ?>     //
eventually needs to have the ID of the correct enquiry
    </p>
   <p>Date: <?php echo $html->input('Appointment/date'); ?>
             <?php echo $html->tagErrorMsg('Appointment/date', 'Date is
required.');  ?>
    </p>
    <p>Time: <?php echo $html->input('Appointment/time'); ?>
              <?php echo $html->tagErrorMsg('Appointment/time', 'Time
is required.');  ?>
    </p>
    <p><?php echo $html->submit('Save');  ?>

For good measure heres the Appoinment Model:
  class Appointment extends AppModel
   {
        var $name = 'Appointment';
      var $belongsTo = array('Enquiry' =>
                                        array('className' => 'Enquiry',
                                        'conditions' => '',
                                        'order' => '',
                                        'foreignKey' =>
'appointment_id'
                                    )
                                );
  }

You've been very helpful so far and it's much appreciated, I know the
problem and solution will be very simple and I'll kick myself when you
tell me.

Kind Regards,

Michael.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to