Friday, September 16, 2011

Re: Editing data

You need the id of A in your data set:

echo $this->Form->input('A.id');

On Sep 16, 10:48 am, Mohd Hasnol <hasnolm...@gmail.com> wrote:
> Hi,
>
> If i use saveAll, it will add another A data. What happen? Thanks.
>
>
>
>
>
>
>
> On Thu, Sep 15, 2011 at 4:54 PM, WebbedIT <p...@webbedit.co.uk> wrote:
> > 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-ha...
>
> > HTH, Paul
> > @phpMagpie
>
> > On Sep 15, 2:59 am, Mohd Hasnol <hasnolm...@gmail.com> 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 <willjbar...@gmail.com> wrote:
> > > > Are you doing a saveAll rather than save in your controller?
>
> > > > On Sep 14, 7:27 pm, Mohd Hasnol <hasnolm...@gmail.com> 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 <
> > dereurom...@googlemail.com
> > > > >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 <hasnolm...@gmail.com> 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
> > > > > > cake-php+unsubscribe@googlegroups.com 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.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscribe@googlegroups.com 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
> > cake-php+unsubscribe@googlegroups.com 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate