That is right. If you don't pick the patient id from a drop down, how will the diagnosis model know which patient to associate with? As far as I know, that's standard practice for Cake's scaffolding. You can set the $displayField property for your patient model, though, so you can choose patient names instead of patient id's.
I'm guessing here, but it sounds like you want to view a patient, then add a related diagnosis from the diagnosis section at the bottom of your scaffolded patient view, and have it remember which patient you were viewing and automatically fill that information in for you? Scaffolding won't do that for you. I'd recommend using bake.php to build your basic views, then edit your patient view so that when you add a related diagnosis, it passes the patient id to the diagnosis add view. From there you could set it to fill in the patient_id field automatically. I hope that helps. hydra12 On Feb 23, 5:01 am, "g5Maniac" <[EMAIL PROTECTED]> wrote: > I am probably missing something fundamental and it may just be a > function of scaffolding and something I need to add in later but... > > if I have a related record ie... > > patient Model > > var $hasMany = 'Diagnosis'; > > Diagnosis Model > > var $belongsTo ='Patient'; > > when I scaffold that and add a new diagnosis it doesn't automatically > add the correct patient id i.e I need to pick the correct one from a > drop down! > > That cant be right...? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
