mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-03 11:47:51 +02:00
Form Helper: add id atributtes for form inputs
If label is clicked, form input assigned with label cannot be focused, because input has not "id" attribute. ```php Form::label('field_name', 'It is label'). Form::input('filed_name', 'It is input') ``` ##Before fix generates: ```html <label for="field_name">It is label</label> <input name="field_name" value="It is input"/> ``` ##After fix generates: ```html <label for="field_name">It is label</label> <input name="field_name" id="field_name" value="It is input"/> ```
This commit is contained in:
@@ -136,6 +136,9 @@
|
||||
|
||||
// Set the input name
|
||||
$attributes['name'] = $name;
|
||||
|
||||
// Set the input id
|
||||
$attributes['id'] = (isset($attributes['id']))?$attributes['id']:$name;
|
||||
|
||||
// Set the input value
|
||||
$attributes['value'] = $value;
|
||||
@@ -286,6 +289,9 @@
|
||||
|
||||
// Set the input name
|
||||
$attributes['name'] = $name;
|
||||
|
||||
// Set the input id
|
||||
$attributes['id'] = (isset($attributes['id']))?$attributes['id']:$name;
|
||||
|
||||
return '<textarea'.Html::attributes($attributes).'>'.$body.'</textarea>';
|
||||
}
|
||||
@@ -310,6 +316,9 @@
|
||||
// Set the input name
|
||||
$attributes['name'] = $name;
|
||||
|
||||
// Set the input id
|
||||
$attributes['id'] = (isset($attributes['id']))?$attributes['id']:$name;
|
||||
|
||||
$options_output = '';
|
||||
|
||||
foreach ($options as $value => $name) {
|
||||
|
Reference in New Issue
Block a user