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

Populating Hidden Field Value with Value Entered in CMS

Go to End



Community Member, 5 Posts

14 February 2009 at 12:38pm

I have created a custom field called retURL for the user to enter a URL in the CMS. I want to access this value in the Custom form hidden field.

I have tried the following and get the value "Array" back:
new HiddenField("retURL","retURL",DataObject::get('RegistrationForm')->column('retURL')),

Can someone point me in the right direction on how to access the retURL value for the specific page that is created off of this RegistrationForm page type?

class RegistrationForm extends Page {

static $db = array(
'retURL' => 'Varchar(255)'

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('retURL','Page URL'), 'Content');
return $fields;

} //class RegistrationForm

class extForm extends Form {
function init() {

class RegistrationForm_Controller extends Page_Controller {

function Form() {
return new extForm($this, "Form", new FieldSet(

// List your fields here
new TextField("first_name", "First Name"),
new TextField("last_name","Last Name"),
new HiddenField("retURL","retURL",DataObject::get('RegistrationForm')->column('retURL')),

), new FieldSet(

// List the action buttons here
new FormAction("", "Sign up")

), new RequiredFields(

// List the required fields here: "Email", "FirstName"