mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Readonly changes to coordinate the readonly appearance between the fields (see datefield)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44376 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
eda727dacc
commit
8b6195ea6b
@ -57,14 +57,13 @@ class TimeField extends TextField {
|
|||||||
* The readonly class for our TimeField
|
* The readonly class for our TimeField
|
||||||
*/
|
*/
|
||||||
class TimeField_Readonly extends TimeField {
|
class TimeField_Readonly extends TimeField {
|
||||||
function Field() {
|
|
||||||
$extraClass = $this->extraClass();
|
|
||||||
$fieldSize = $this->maxLength ? min( $this->maxLength, 30 ) : 30;
|
|
||||||
if($this->maxLength) {
|
|
||||||
return "<input readonly=\"readonly\" class=\"text maxlength$extraClass readonly\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" size=\"$fieldSize\" />";
|
|
||||||
} else {
|
|
||||||
return "<input readonly=\"readonly\" class=\"text$extraClass readonly\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function Field() {
|
||||||
|
if( $this->value )
|
||||||
|
$val = $this->attrValue();
|
||||||
|
else
|
||||||
|
$val = '<i>(not set)</i>';
|
||||||
|
|
||||||
|
return "<span class=\"readonly\" id=\"" . $this->id() . "\">$val</span>";
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user