Add required attribute to CRUD form dropdown
This commit is contained in:
@@ -67,7 +67,7 @@ class PageModel extends Model {
|
||||
// Pull sections from cache
|
||||
$sections = Db::getSections();
|
||||
|
||||
return [0 => 'Select section'] + array_combine(
|
||||
return ['' => 'Select section'] + array_combine(
|
||||
array_column($sections, 'id'),
|
||||
array_column($sections, 'title')
|
||||
);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<?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) { ?>
|
||||
<option value="<?= $dropdownKey; ?>"><?= $value; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
<?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) { ?>
|
||||
<option value="<?= $dropdownKey; ?>"
|
||||
<?= $this->model->$name == $dropdownKey ? 'selected' : ''; ?>>
|
||||
|
||||
Reference in New Issue
Block a user