summaryrefslogtreecommitdiff
path: root/public/app/controllers/JsonToForm.php
diff options
context:
space:
mode:
authorGeo Xalkis <gx23100@gmail.com>2023-05-02 01:02:48 +0300
committerGeo Xalkis <gx23100@gmail.com>2023-05-02 01:02:48 +0300
commit931a93cd7bae092e2752064568cebe407d2bf46e (patch)
treeaa25822cc3f9a66f27e6462c7cc7c78d9cdd87fd /public/app/controllers/JsonToForm.php
parent2b4ed611e7e001ad8ea93ef3e8cdce35bc56dc07 (diff)
downloadgyraf1gov-931a93cd7bae092e2752064568cebe407d2bf46e.tar.gz
gyraf1gov-931a93cd7bae092e2752064568cebe407d2bf46e.tar.bz2
gyraf1gov-931a93cd7bae092e2752064568cebe407d2bf46e.zip
(almost) final structrure of forms
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
];