Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Passing value from one form to another

Go to End

3 Posts   2048 Views


Community Member, 21 Posts

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!


Forum Moderator, 5523 Posts

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')) {

return $form;


Community Member, 21 Posts

8 March 2010 at 2:37am

Brilliant...thank you very much!