Add required attribute to CRUD form dropdown

This commit is contained in:
Riyyi
2021-05-10 15:06:59 +02:00
parent 0d146728a0
commit 4f6894062c
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ class PageModel extends Model {
// Pull sections from cache // Pull sections from cache
$sections = Db::getSections(); $sections = Db::getSections();
return [0 => 'Select section'] + array_combine( return ['' => 'Select section'] + array_combine(
array_column($sections, 'id'), array_column($sections, 'id'),
array_column($sections, 'title') array_column($sections, 'title')
); );
+1 -1
View File
@@ -43,7 +43,7 @@
<?php } else if ($attribute[1] == 'dropdown') { ?> <?php } else if ($attribute[1] == 'dropdown') { ?>
<select name="<?= $name; ?>" class="custom-select"> <select name="<?= $name; ?>" class="custom-select" <?= $required; ?>>
<?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?> <?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?>
<option value="<?= $dropdownKey; ?>"><?= $value; ?></option> <option value="<?= $dropdownKey; ?>"><?= $value; ?></option>
<?php } ?> <?php } ?>
+1 -1
View File
@@ -45,7 +45,7 @@
<?php } else if ($attribute[1] == 'dropdown') { ?> <?php } else if ($attribute[1] == 'dropdown') { ?>
<select name="<?= $name; ?>" class="custom-select"> <select name="<?= $name; ?>" class="custom-select" <?= $required; ?>>
<?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?> <?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?>
<option value="<?= $dropdownKey; ?>" <option value="<?= $dropdownKey; ?>"
<?= $this->model->$name == $dropdownKey ? 'selected' : ''; ?>> <?= $this->model->$name == $dropdownKey ? 'selected' : ''; ?>>