summaryrefslogtreecommitdiff
path: root/public/app/controllers/JsonToForm.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/controllers/JsonToForm.php')
-rw-r--r--public/app/controllers/JsonToForm.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/public/app/controllers/JsonToForm.php b/public/app/controllers/JsonToForm.php
index 5a60891..1b05af7 100644
--- a/public/app/controllers/JsonToForm.php
+++ b/public/app/controllers/JsonToForm.php
@@ -181,7 +181,9 @@ class JsonToForm
- $html = '';
+ $html = "
+ <div class='row'>
+ ";
foreach ($formJson->form as $key => $field) {
@@ -227,13 +229,13 @@ class JsonToForm
} else { // select is single; draw select + add empty option
$html .="
- <select id='{$name}' class='form-select form-select-sm' name='{$name}' style='width:100%'>
- <option value='0'>(επιλέξτε)</option>";
+ <select id='{$name}' class='form-select form-select-sm' name='{$name}' style='width:100%'>";
- // // prepare initialization of select2 (single)
- // $initSelectsJS .= "
- // var {$name} = $('#{$name}');
- // {$name}.select2({ allowClear: true });";
+ // prepare initialization of select2 (single)
+ $initSelectsJS .= "
+ var {$name} = $('#{$name}');
+ {$name}.select2({ });
+ {$name}.val(null).trigger('change')";
// prepare check if empty field
$checkFilledJS .= "
@@ -338,7 +340,7 @@ class JsonToForm
}
return [
- 'html' => $html,
+ 'html' => $html .'</div>',
'init_js' => $initSelectsJS,
'values_js' => $checkFilledJS
];