1779 Posts in 582 Topics by 556 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1308 Views |
-
Passing value from one form to another

7 March 2010 at 3:24am
Hello all. I'm migrating an inherited website over to Silverstripe and trying to implement all that is presently there. They have a one field form in the sidebar (Form A) which takes an email address and then on submit, a full form (FormB) is presented with the usual field (Name, Addy, Email Addy, etc.) and the email address is populated by what was filled out in the sidebar form.
I have Form B working just fine (validating, saving, redirecting), but I am unable to figure out how exactly to pass the email address value from Form A to Form B.
Form A is in the Page Controller and Form B is in its own Controller.
I'm sure it's a simple this I'm just not getting head around, even after an exhaustive search of the forum archives.
I greatly appreciate any help on this...thanks!
Patrick -
Re: Passing value from one form to another

7 March 2010 at 7:47pm
You could do it a number of ways, probably the easier (and cleanest) is to use the Session class to handle passing values between forms. So in the process function for form A you would have
Session:set('PreviousFormsData', $data);
Then on form B you would load the data from that session
$form = new Form(.....
if($data = Session::get('PreviousFormsData')) {
$form->loadDataFrom($data);
}return $form;
| 1308 Views | ||
|
Page:
1
|
Go to Top |


