Thursday, July 8, 2010

Re: can't retrieve data from a form

sth learned :) thx jeremy

On 8 Jul., 17:55, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> That's not Cake being fussy - it's HTML. The helper just does the heavy lifting of writing html for you, and a form has to open, contain elements and then close. Anything not inside the form will be ignored.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 8 Jul 2010, at 16:53, Tomfox Wiranata wrote:
>
> > i did name the form and i accessed it correct...what i did wrong:
>
> > obviously cake is sensitive about the order.. i had input, create
> > submit...
>
> > now it works...thx :)
>
> > On 8 Jul., 16:32, Shaz <shazam...@gmail.com> wrote:
> >> The form needs to be created with a name and then it also needs to
> >> end:
>
> >> $form->create('FormName');
> >> $form->input( ... etc etc );
> >> $form->end('Submit');
>
> >> And you should be able to access your form data via $this-
>
> >>> data['FormName'][ inputfield ].
>
> >> On Jul 8, 1:31 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> >>> hi,
>
> >>> i am trying to extract data from a form to update user information.
> >>> but somehow i cant extract the information from the form. i echo the
> >>> current information in input fields. everything works fine. the
> >>> echoing, the calling of my "updateProfile" function from my view:
>
> >>> <span class="profiledata"><?php   echo $form->input('created',
> >>> array('value' => $user['created']));   ?></span>
>
> >>> <?php echo $form->create('User', array('action' => 'updateProfile'));?
>
> >>> <div class="button"> <?php echo $form->button('Sichern', array('type'
> >>> => 'submit'));?>  </div>
>
> >>> my function that updates the given info
>
> >>>      function updateProfile()
> >>>      {
>
> >>>                 $updates = $this->User->findByUsername($this->Session->read('User.username'));
>
> >>>                                 WORKS -> $updates['User']['firstname']= 'Trötde';
> >>>                                 WORKS -> $updates['User']['lastname']='tröter';
> >>>                                 sends NULL ->  //$updates['User']['username']=$this->data['User']
> >>> ['username'];
> >>>                                 sends NULL -> $updates['User']['created']=$this->data['User']
> >>> ['created'];
>
> >>>                         if ( $this->User->save($updates)){
> >>>                                 $this->Session->setFlash('Profil aktualisiert');
> >>>                                 $this->redirect(array('controller' => 'users', 'action' =>
> >>> 'profile'));
> >>>                         }
> >>>                         else{
> >>>                                 $this->Session->setFlash('Speichern fehlgeschlagen');
> >>>                                 $this->redirect(array('controller' => 'users', 'action' =>
> >>> 'editprofile'));
> >>>                         }
>
> >>>      }
>
> >>> now if i set values as string, like "trötde" above, it works. so the
> >>> saving process is correct. but if i wanna get the data from the form
> >>> with "$this->data['User']['created']" the value is null..
>
> >>> can u see the problem ?? thx :)
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > 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?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

No comments: