The Html helper functions pull their prepopulated values from $this- >data, which you will be setting in the controller. So, the two options are to provide an explicit value, or to get the $this->data set up how you want.
Option 1, simple :) Rather than rely on the Html helper to automatically prepopulate from the $this->data, you can supply the input field's value. $html->input('Picture/picaddr', array('value'=>$member['Picture']['0'] ['picaddr'])) Option 2, more complex. The Html helper functions prepopulate from the $this->data of your controller action. So, if you have $html->input('Picture/picaddr') in a view, it will load its value from, and save the value to, $this- >data['Picture']['picaddr'] in your controller. To get the data in the field, just make sure this data attribute is set correctly in your controller. The main reason that it won't be working right now, is that your Member hasMany Pictures, so when you have $this->data = $this->Member->read(null,$id) as is probably in your edit action, then the format of $this->data is more like $this->data = array( 'Member' => array( ... member details ... ), 'Picture' => array( [0] => array( ..picture details... ), [1] => array( ..picture details... ) ) ) If instead you have $this->data = $this->Picture->read(null,$id) $this->data['Picture'] = $this->data['Picture'][0] and your form element $html->input('Picture/picaddr') should prepopulate with the first picture's address. [EMAIL PROTECTED] wrote: > Here's the db situation: members model has a foreign key(pictureid) to > the pictures model(id). > > I can successfully associate two models with each other, therefore I > am able to display the data from the associated model in my index > view: > > <?php echo $member['Picture']['0']['picaddr'];?> > > Now I want to be able to send the data from the associated model (that > appears in my index view) to the edit view. In my edit view, I am > able to display the parent model data by : > > <?php echo $html->input('Member/fname', array('size' => '40'))?> > > but when I try to use this: > > <?php echo $html->input('Picture/picaddr', array('size' => '40'))?> > > nothing appears in the text field in my edit view. > > Any idea what I am doing wrong? Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---