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 <[email protected]> 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 <[email protected]> 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 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 [email protected]
> 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
>
>
--
View this message in context:
http://old.nabble.com/Populating-form-fields-from-session-variables-tp26601639p26604855.html
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 [email protected]
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