Add 'readOnly' spec to form field
Same as disabled except data is still posted back
This commit is contained in:
parent
30bb33b6ba
commit
0b345ad592
|
|
@ -94,6 +94,11 @@ class FormField
|
|||
*/
|
||||
public $required = false;
|
||||
|
||||
/**
|
||||
* @var bool Specify if the field is read-only or not.
|
||||
*/
|
||||
public $readOnly = false;
|
||||
|
||||
/**
|
||||
* @var bool Specify if the field is disabled or not.
|
||||
*/
|
||||
|
|
@ -266,6 +271,7 @@ class FormField
|
|||
'placeholder',
|
||||
'dependsOn',
|
||||
'required',
|
||||
'readOnly',
|
||||
'disabled',
|
||||
'cssClass',
|
||||
'stretch',
|
||||
|
|
@ -417,6 +423,10 @@ class FormField
|
|||
$attributes = $attributes + ['disabled' => 'disabled'];
|
||||
}
|
||||
|
||||
if ($position == 'field' && $this->readOnly) {
|
||||
$attributes = $attributes + ['readonly' => 'readonly'];
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue