mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Readonly work
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44405 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5b08367d5b
commit
70d41d5dc9
@ -37,7 +37,10 @@ class TextareaField extends FormField {
|
||||
$disabled = $this->disabled ? " disabled=\"disabled\"" : "";
|
||||
$readonly = $this->readonly ? " readonly=\"readonly\"" : "";
|
||||
|
||||
return "<textarea $disabled$readonly $classAttr id=\"" . $this->id() . "\" name=\"{$this->name}\" rows=\"{$this->rows}\" cols=\"{$this->cols}\">".Convert::raw2att($this->value)."</textarea>";
|
||||
if( $this->readonly )
|
||||
return "<span $disabled$readonly $classAttr id=\"" . $this->id() . "\" name=\"{$this->name}\" rows=\"{$this->rows}\" cols=\"{$this->cols}\">" . ( $this->value ? Convert::raw2att( $this->value ) : '<i>(not set)</i>' ) . "</span>";
|
||||
else
|
||||
return "<textarea $disabled$readonly $classAttr id=\"" . $this->id() . "\" name=\"{$this->name}\" rows=\"{$this->rows}\" cols=\"{$this->cols}\">".Convert::raw2att($this->value)."</textarea>";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,5 +66,9 @@ class TextareaField extends FormField {
|
||||
$this->readonly = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function Type() {
|
||||
return parent::Type() . ( $this->readonly ? ' readonly' : '' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user