As #2will advised, your problem is: $this->B->save($this->data) Should be: $this->B->saveAll($this->data)
http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo HTH, Paul @phpMagpie On Sep 15, 2:59 am, Mohd Hasnol <[email protected]> wrote: > edit.ctp > > <?php echo $this->Form->create('B', array('action'=>'edit'));?> > <?php > echo $this->Form->input('A.first_name'); > echo $this->Form->input('A.last_name'); > echo $this->Form->input('A.contact_no'); > echo $this->Form->input('A.email'); > echo $this->Form->input('B.username'); > echo $this->Form->input('B.password');?> > <?php echo $this->Form->end('Submit');?> > > inside B controller > > function edit($id = NULL) { > $this->B->id = $id; > > if (empty($this->data)){ > $this->data = $this->B->read(); > } else { > if ($this->B->save($this->data)) { > $this->Session->setFlash('Data updated'); > > } > } > } > > > > > > > > On Thu, Sep 15, 2011 at 5:05 AM, #2Will <[email protected]> wrote: > > Are you doing a saveAll rather than save in your controller? > > > On Sep 14, 7:27 pm, Mohd Hasnol <[email protected]> wrote: > > > inside edit.ctp > > > > <?php echo $this->Form->create('Useradmin', array('action'=>'edit'));?> > > > <?php > > > echo $this->Form->input('A.first_name'); > > > echo $this->Form->input('A.last_name'); > > > echo $this->Form->input('A.contact_no'); > > > echo $this->Form->input('A.email'); > > > echo $this->Form->input('B.username'); > > > echo $this->Form->input('B.password');?> > > > > i only can edit username and password. > > > > Thanks. > > > > On Wed, Sep 14, 2011 at 9:50 AM, euromark <[email protected] > > >wrote: > > > > > a less abstract code example would help > > > > you code post your "real" code. maybe this way we can figure out whats > > > > wrong with your code. > > > > > On 14 Sep., 05:35, nOLL <[email protected]> wrote: > > > > > Hi, > > > > > > I have a form that use 2 models(A,B). For create and view function it > > > > > was run perfectly, but there is a problem when editing the form. I > > use > > > > > B controller for all the function(CRUD) and i only can edit the B > > > > > table attributes but for A attributes the data remain the same. > > > > > > I follow thishttp:// > > > > book.cakephp.org/view/1650/hasMany-through-The-Join-Model > > > > > for the form. > > > > > > Whats the problem actually? > > > > > > Thanks, > > > > > nOLL > > > > > -- > > > > Our newest site for the community: CakePHP Video Tutorials > > > >http://tv.cakephp.org > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > > [email protected] For more options, visit this > > group > > > > athttp://groups.google.com/group/cake-php > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
