Skip to content

Commit ad90cb8

Browse files
committed
Set value correctly in custom file input.
1 parent 76a417e commit ad90cb8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/View/Helper/BootstrapFormHelper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,9 @@ public function file($fieldName, array $options = []) {
399399
];
400400

401401
$fakeInputCustomOptions = $options['_input'];
402-
$fakeInputCustomOptions += [
403-
'value' => ''
404-
];
405402
$fakeButtonCustomOptions = $options['_button'];
406403
unset($options['_input'], $options['_button']);
407404

408-
$options += ['secure' => true];
409405
$options = $this->_initInputField($fieldName, $options);
410406
unset($options['type']);
411407
$countLabel = $options['count-label'];
@@ -415,6 +411,9 @@ public function file($fieldName, array $options = []) {
415411
'onchange' => "document.getElementById('".$options['id']."-input').value = (this.files.length <= 1) ? this.files[0].name : this.files.length + ' ' + '" . $countLabel . "';"
416412
]));
417413

414+
$fakeInputCustomOptions += [
415+
'value' => $options['val']['name']
416+
];
418417
$fakeInput = $this->text($fieldName, array_merge($fakeInputCustomOptions, [
419418
'name' => $fieldName.'-text',
420419
'readonly' => 'readonly',

0 commit comments

Comments
 (0)