Browse Source

Views: Make dropdown placeholder non-selectable

master
Riyyi 2 years ago
parent
commit
dfdcd992ad
  1. 5
      app/views/admin/crud/create.php
  2. 1
      app/views/admin/crud/edit.php

5
app/views/admin/crud/create.php

@ -45,7 +45,10 @@
<select name="<?= $name; ?>" class="custom-select" <?= $required; ?>>
<?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?>
<option value="<?= $dropdownKey; ?>"><?= $value; ?></option>
<option value="<?= $dropdownKey; ?>"
<?= ($dropdownKey == 0) ? 'disabled selected' : ''; ?>>
<?= $value; ?>
</option>
<?php } ?>
</select>

1
app/views/admin/crud/edit.php

@ -48,6 +48,7 @@
<select name="<?= $name; ?>" class="custom-select" <?= $required; ?>>
<?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?>
<option value="<?= $dropdownKey; ?>"
<?= ($dropdownKey == 0) ? 'disabled' : ''; ?>
<?= $this->model->$name == $dropdownKey ? 'selected' : ''; ?>>
<?= $value; ?>
</option>

Loading…
Cancel
Save