Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Consistent use of XML values for fields 'readonly' and 'disabled' #1592

Merged
merged 1 commit into from

2 participants

@benjaminpick

As I said in #1188, this should be implemented in all field implementations (including joomla-cms).

@LouisLandry

Thanks a bunch @benjaminpick. I'm going to leave it open for a day or so in case anyone wants to comment and we'll get it merged in. Is there a chance that later on when you get more time you could go through and clean up the field implementations you mention?

@benjaminpick
@LouisLandry LouisLandry merged commit 92b45de into joomla:staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 10, 2012
  1. Close #1188: Consistent use of XML values for fields 'readonly' and '…

    Benjamin Pick authored
    …disabled'
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 1 deletion.
  1. +25 −1 libraries/joomla/form/field.php
View
26 libraries/joomla/form/field.php
@@ -141,6 +141,24 @@
protected $required = false;
/**
+ * The disabled state for the form field. If true then there must not be a possibility
+ * to change the pre-selected value, and the value must not be submitted by the browser.
+ *
+ * @var boolean
+ * @since 12.3
+ */
+ protected $disabled = false;
+
+ /**
+ * The readonly state for the form field. If true then there must not be a possibility
+ * to change the pre-selected value, and the value must submitted by the browser.
+ *
+ * @var boolean
+ * @since 12.3
+ */
+ protected $readonly = false;
+
+ /**
* The form field type.
*
* @var string
@@ -240,6 +258,8 @@ public function __get($name)
case 'multiple':
case 'name':
case 'required':
+ case 'disabled':
+ case 'readonly':
case 'type':
case 'validate':
case 'value':
@@ -324,9 +344,13 @@ public function setup(SimpleXMLElement $element, $value, $group = null)
$multiple = (string) $element['multiple'];
$name = (string) $element['name'];
$required = (string) $element['required'];
+ $disabled = (string) $element['disabled'];
+ $readonly = (string) $element['readonly'];
- // Set the required and validation options.
+ // Set the required, disabled and validation options.
$this->required = ($required == 'true' || $required == 'required' || $required == '1');
+ $this->disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');
+ $this->readonly = ($readonly == 'true' || $readonly == 'readonly' || $readonly == '1');
$this->validate = (string) $element['validate'];
// Add the required class if the field is required.
Something went wrong with that request. Please try again.