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

receiving parameters in a form?

Go to End



Community Member, 165 Posts

12 October 2012 at 3:07pm

Hi, I have a form that I am calling from a 2.4 page.

I have a function that calls the form

$val1= new TextField("val1", "val1", "1");
$val2 = new TextField("val2", "val2", "2");
$val3 =new TextField("val3", "val3", 3);

$params = new FieldSet($val1, $val2 , $val3 );

return new frmAnswerQuestion($this, 'answerQuestion', $params);
return "<p>Sorry, you're not a member</p>";

and then the form receives the params

class frmAnswerQuestion extends Form{

function __construct($controller, $FormName, $fields) {

Debug::show("val1: " . $fields->val1);

And the first Debug::show() works fine and shows that there are values being received. Correctly.

But if I try to access the actual contents, as in the 2nd debug, I just get a null value.

How do I access the value of val1?