diff --git a/forms/DatetimeField.php b/forms/DatetimeField.php index 72720e424..14cdb9d90 100644 --- a/forms/DatetimeField.php +++ b/forms/DatetimeField.php @@ -181,6 +181,20 @@ class DatetimeField extends FormField { return sprintf($this->getConfig('datetimeorder'), $valDate, $valTime); } + + function setDisabled($bool) { + parent::setDisabled($bool); + $this->dateField->setDisabled($bool); + $this->timeField->setDisabled($bool); + if($this->timezoneField) $this->timezoneField->setDisabled($bool); + } + + function setReadonly($bool) { + parent::setReadonly($bool); + $this->dateField->setReadonly($bool); + $this->timeField->setReadonly($bool); + if($this->timezoneField) $this->timezoneField->setReadonly($bool); + } /** * @return DateField diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 0bee4d8e4..143ca7807 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -175,6 +175,9 @@ class HtmlEditorField extends TextareaField { return $field; } + public function performDisabledTransformation() { + return $this->performReadonlyTransformation(); + } } /** diff --git a/forms/MoneyField.php b/forms/MoneyField.php index 131b31fb2..f9a54a13d 100644 --- a/forms/MoneyField.php +++ b/forms/MoneyField.php @@ -127,10 +127,15 @@ class MoneyField extends FormField { function setReadonly($bool) { parent::setReadonly($bool); - if($bool) { - $this->fieldAmount = $this->fieldAmount->performReadonlyTransformation(); - $this->fieldCurrency = $this->fieldCurrency->performReadonlyTransformation(); - } + $this->fieldAmount->setReadonly($bool); + $this->fieldCurrency->setReadonly($bool); + } + + function setDisabled($bool) { + parent::setDisabled($bool); + + $this->fieldAmount->setDisabled($bool); + $this->fieldCurrency->setDisabled($bool); } /** diff --git a/forms/PhoneNumberField.php b/forms/PhoneNumberField.php index 0326781b6..59defb192 100644 --- a/forms/PhoneNumberField.php +++ b/forms/PhoneNumberField.php @@ -28,33 +28,36 @@ class PhoneNumberField extends FormField { } public function Field() { - $field = new FieldGroup( $this->name ); - $field->setID("{$this->name}_Holder"); - - - list( $countryCode, $areaCode, $phoneNumber, $extension ) = $this->parseValue(); - + $fields = new FieldGroup( $this->name ); + $fields->setID("{$this->name}_Holder"); + list($countryCode, $areaCode, $phoneNumber, $extension) = $this->parseValue(); $hasTitle = false; - if ($this->value=="") - { - $countryCode=$this->countryCode; - $areaCode=$this->areaCode; - $extension=$this->ext; - } + if ($this->value=="") { + $countryCode=$this->countryCode; + $areaCode=$this->areaCode; + $extension=$this->ext; + } - if( $this->countryCode !== null ) - $field->push( new NumericField( $this->name.'[Country]', '+', $countryCode, 4 ) ); + if($this->countryCode !== null) { + $fields->push(new NumericField($this->name.'[Country]', '+', $countryCode, 4)); + } - if( $this->areaCode !== null ){ - $field->push( new NumericField( $this->name.'[Area]', '(', $areaCode, 4 ) ); - $field->push( new NumericField( $this->name.'[Number]', ')', $phoneNumber, 10 ) ); - }else{ - $field->push( new NumericField( $this->name.'[Number]', '', $phoneNumber, 10 ) ); + if($this->areaCode !== null) { + $fields->push(new NumericField($this->name.'[Area]', '(', $areaCode, 4)); + $fields->push(new NumericField($this->name.'[Number]', ')', $phoneNumber, 10)); + } else { + $fields->push(new NumericField($this->name.'[Number]', '', $phoneNumber, 10)); } - if( $this->ext !== null ) - $field->push( new NumericField( $this->name.'[Extension]', 'ext', $extension, 6 ) ); + if($this->ext !== null) { + $field->push(new NumericField( $this->name.'[Extension]', 'ext', $extension, 6)); + } + + foreach($fields as $field) { + $field->setDisabled($this->isDisabled()); + $field->setReadonly($this->isReadonly()); + } return $field; }