diff --git a/forms/AssetField.php b/forms/AssetField.php index e344811c5..84e331146 100644 --- a/forms/AssetField.php +++ b/forms/AssetField.php @@ -476,6 +476,17 @@ class AssetField extends FileField { return $this->setConfig('downloadTemplateName', $downloadTemplateName); } + public function extraClass() { + if($this->isDisabled()) { + $this->addExtraClass('disabled'); + } + if($this->isReadonly()) { + $this->addExtraClass('readonly'); + } + + return parent::extraClass(); + } + public function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); diff --git a/forms/FormField.php b/forms/FormField.php index 335c22f06..69b05a5ec 100644 --- a/forms/FormField.php +++ b/forms/FormField.php @@ -460,15 +460,7 @@ class FormField extends RequestHandler { // // CSS class needs to be different from the one rendered through {@link FieldHolder()}. if($this->Message()) { - $classes[] = 'holder-' . $this->MessageType(); - } - - if($this->isDisabled()) { - $classes[] = 'disabled'; - } - - if($this->isReadonly()) { - $classes[] = 'readonly'; + $classes[] .= 'holder-' . $this->MessageType(); } return implode(' ', $classes); diff --git a/forms/UploadField.php b/forms/UploadField.php index 56e1a96bb..deecaa3d0 100644 --- a/forms/UploadField.php +++ b/forms/UploadField.php @@ -912,6 +912,17 @@ class UploadField extends FileField { ); } + public function extraClass() { + if($this->isDisabled()) { + $this->addExtraClass('disabled'); + } + if($this->isReadonly()) { + $this->addExtraClass('readonly'); + } + + return parent::extraClass(); + } + public function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');