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:

Customising the CMS /

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

hiddenField without value

Go to End



Community Member, 173 Posts

7 June 2011 at 10:00pm


does anybody know if there is a problem with HiddenFields?

I am trying this:

$root = $this->ParentID;
		// debug::show($root); die();
		$fields = page::getCMSFields();
		$fields->addFieldToTab('Root.Content.Main', new HiddenField($name = "AngeboteHolderID", $title = "", $value = $this->ParentID));

But the generated source looks always like this:

<input class="hidden nolabel" type="hidden" id="Form_EditForm_AngeboteHolderID" name="AngeboteHolderID" value="0" />

Even if i use: $fields->addFieldToTab('Root.Content.Main', new HiddenField($name = "AngeboteHolderID", $title = "", $value = "10")); for example.


	function Field() {
		$extraClass = $this->extraClass();
		return "<input class=\"hidden$extraClass\" type=\"hidden\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />";

Is there a problem with $this->attrValue()?

Hpe anybody can help.

Greetings, Carsten.