sorry correction :

echo $form->input('name', $options = array('value' => $data
['name']));

On Dec 2, 7:39 pm, Saliem <than.sal...@gmail.com> wrote:
> at some point you must save the posted data to the session variable
> and set the variable for use in the view template.
>
> once you do that do
>
> echo $form->input('name', $options = array('value' = $data['name']));
>
> in the view template and where $data is a variable that contains the
> data from the session that you would set in a controller action
>
> something like that. please check the cakephp docs on how to set
> values for input elements and other elements. I am pretty sure you set
> an array to $options, but I havent double checked
>
> Hope that helps
>
> On Dec 1, 11:54 pm, nashrul <anas_a...@yahoo.com> wrote:
>
> > Sorry, I didn't think you get my message...
> > What I want is, when user is in the edit page... the form in edit page will
> > be populated with the values from session variables..So I created the form
> > in ediit.ctp file like this :
>
> > //app/views/persons/edit.ctp
> > <h1>Edit Person</h1>
> > <?
>
> > <?
> >         echo $form->create('Person');
> >         echo $form->input('name');
> >         echo $form->input('pob');
> >         echo $form->input('dob');
> >         echo $form->input('address');
> >         echo $form->end('Save');
> > ?>
>
> > Those form fields (name, pob, dob, address) will be automatically populated
> > with the values from session variables. Maybe in the standard form field it
> > should be like this:
>
> > //app/views/persons/edit.ctp
> > echo "<INPUT TYPE='text' NAME='name' value="$_SESSION['person.name']">";
> > echo "<INPUT TYPE='text' NAME='name' value="$_SESSION['person.pob']">";
> > echo "<INPUT TYPE='text' NAME='name' value="$_SESSION['person.dob']">";
> > echo "<INPUT TYPE='text' NAME='name' value="$_SESSION['person.address']">";
> > How can I do this using form helper ??
>
> > Thanks..
>
> > Saliem wrote:
>
> > > sorry:
>
> > > $this->set('data', $this->Session->read('session_variable_name'));
>
> > > On Dec 1, 8:46 pm, Saliem <than.sal...@gmail.com> wrote:
> > >> $this->set('data', $this->data);
>
> > >> OR
>
> > >> $this->ser('data', $this->Session->read('session_variable_name'));
>
> > >> something along these lines
>
> > >> On Dec 1, 7:05 pm, nashrul <anas_a...@yahoo.com> wrote:
>
> > >> > HI, I'm new to cakephp
> > >> > I'm trying to populate form fields from the session variables..
> > >> > I have a scenario like this.
> > >> > 1. User fills the form.
> > >> >    When the user clicks next button, form fields are saved to the
> > >> session
> > >> > variable.
> > >> > 2. User is displayed with the data he entered before to confirm.
> > >> > 3. If the data is correct, it proceeds to save the data. otherwise, it
> > >> will
> > >> > display edit page.
> > >> >    In edit page, form fields will be populated by the data from the
> > >> session
> > >> > variables. If the
> > >> >    process   finishes, user
> > >> >    will go the confirmation page, and repeats step 2.
> > >> > 4. when user confirms the data, set method in the model is called and
> > >> save
> > >> > method is called.
>
> > >> > In step 3, how can I populate form fields from the session variables
> > >> ?..
> > >> > I've read about form and html helpers, and the documentation says that
> > >> html
> > >> > helper is deprecated.. so I look to form helper.
> > >> > In form helper, afaik, there's no way to set form fields from
> > >> variables..
> > >> > Correct me if I was wrong.or somebody has a better idea to solve my
> > >> problem
> > >> > ??
> > >> > Thanks...
> > >> > I use cakephp 1.2
> > >> > --
> > >> > View this message in
> > >> context:http://old.nabble.com/Populating-field-from-session-variables-tp26601...
> > >> > Sent from the CakePHP mailing list archive at Nabble.com.
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > --
> > View this message in 
> > context:http://old.nabble.com/Populating-form-fields-from-session-variables-t...
> > Sent from the CakePHP mailing list archive at Nabble.com.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to