Skip to content

Commit 6f4b11c

Browse files
committed
Add entire autofill_attributes string to search text if it is not an array.
1 parent 4291161 commit 6f4b11c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

resources/views/modal/save.blade.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,17 @@
6262
var searchText = '';
6363
try {
6464
var autofill_attributes = JSON.parse(@json($request->input('autofill_attributes')));
65-
searchText = autofill_attributes.map(function (attr) {
66-
let input = $(modalId + " [name='" + attr + "']").serializeArray()[0];
67-
return input ? input['value'] : '';
68-
}).join(' ');
65+
if (Array.isArray(autofill_attributes)) {
66+
searchText = autofill_attributes.map(function (attr) {
67+
let input = $(modalId + " [name='" + attr + "']").serializeArray()[0];
68+
return input ? input['value'] : '';
69+
}).join(' ');
70+
} else {
71+
let input = $(modalId + " [name='"+ autofill_attributes +"']").serializeArray()[0];
72+
if (input) {
73+
searchText = input['value'];
74+
}
75+
}
6976
} catch (e) {
7077
let input = $(modalId + " [name='{{ $request->input('autofill_attributes') }}']").serializeArray()[0];
7178
if (input) {

0 commit comments

Comments
 (0)