Version: current

     1 <?php
     2 /**
     3  * Hidden field.
     4  * @package forms
     5  * @subpackage fields-dataless
     6  */
     7 class HiddenField extends FormField {
     8     /**
     9      * Returns an hidden input field, class="hidden" and type="hidden"
    10      */
    11     function Field() {
    12         $attributes = array(
    13             'type' => 'hidden',
    14             'class' => 'hidden' . $this->extraClass(),
    15             'id' => $this->id(),
    16             'name' => $this->Name(),
    17             'value' => $this->attrValue(),
    18         );
    19
    20         return $this->createTag('input', $attributes);
    21     }
    22
    23     function performReadonlyTransformation() {
    24         $clone = clone $this;
    25         $clone->setReadonly(true);
    26         return $clone;
    27     }
    28
    29     function IsHidden() {
    30         return true;
    31     }
    32
    33     static function create($name) { return new HiddenField($name); }
    34 }
    35
    36 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -