Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » hiddenField without value

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

Page: 1
Go to End
Author Topic: 680 Views
  • dacar
    Community Member
    168 Posts

    hiddenField without value Link to this post


    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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.