Merge pull request #6919 from open-sausages/pulls/4.0/177-editor-form-tabindex

Pass autofocus flag to front-end
This commit is contained in:
Chris Joe 2017-05-16 13:08:48 +12:00 committed by GitHub
commit 961395ba25
4 changed files with 41 additions and 1 deletions

View File

@ -169,6 +169,11 @@ class FormField extends RequestHandler
*/
protected $disabled = false;
/**
* @var bool
*/
protected $autofocus = false;
/**
* Custom validation message for the field.
*
@ -716,7 +721,8 @@ class FormField extends RequestHandler
'class' => $this->extraClass(),
'id' => $this->ID(),
'disabled' => $this->isDisabled(),
'readonly' => $this->isReadonly()
'readonly' => $this->isReadonly(),
'autofocus' => $this->isAutofocus()
);
if ($this->Required()) {
@ -1222,6 +1228,26 @@ class FormField extends RequestHandler
return $this;
}
/**
* @return bool
*/
public function isAutofocus()
{
return $this->autofocus;
}
/**
* Sets a autofocus flag on this FormField.
*
* @param bool $autofocus
* @return $this
*/
public function setAutofocus($autofocus)
{
$this->autofocus = $autofocus;
return $this;
}
/**
* Returns a read-only version of this field.
*
@ -1560,6 +1586,7 @@ class FormField extends RequestHandler
'customValidationMessage' => $this->getCustomValidationMessage(),
'validation' => $this->getSchemaValidation(),
'attributes' => [],
'autoFocus' => $this->isAutofocus(),
'data' => [],
];
}

View File

@ -28,6 +28,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": [],
"data": [],
@ -48,6 +49,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": [],
"data": [],
@ -70,6 +72,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": {
"type": "submit"
@ -94,6 +97,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": {
"type": "button"
@ -118,6 +122,7 @@
"leftTitle": null,
"readOnly": null,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": [],
"data": {
@ -149,6 +154,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": {
"type": "submit"
@ -173,6 +179,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": {
"type": "submit"

View File

@ -28,6 +28,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"attributes": [],
"data": [],

View File

@ -28,6 +28,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"validation": {
"required": true,
@ -54,6 +55,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"validation": {
"date": true
@ -80,6 +82,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"validation": {
"numeric": true
@ -102,6 +105,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"validation": {
"currency": true
@ -124,6 +128,7 @@
"leftTitle": null,
"readOnly": false,
"disabled": false,
"autoFocus": false,
"customValidationMessage": "",
"validation": [],
"attributes": [],