Required fields are now automatic from model validation
Make required asterisk more obvious
This commit is contained in:
parent
9ae7b5785b
commit
62df6948b0
|
|
@ -3,6 +3,7 @@
|
|||
- Added new properties to RelationController: readOnly, showSorting, defaultSort.
|
||||
- Hashable, Sluggable, Purgeable and Validation traits must now be used in the Model class definition.
|
||||
- Plugins can now extend existing Back-end navigation menu items, see Event docs for an example.
|
||||
- Required form fields now sport an asterisk (*) character at the end of their label.
|
||||
|
||||
* **Build 116** (2014-07-07)
|
||||
- Added new layout and page method `onInit()` called after components are initialized and before AJAX requests are processed.
|
||||
|
|
|
|||
|
|
@ -8159,8 +8159,9 @@ label {
|
|||
.form-group.is-required > label:after {
|
||||
color: #ff0000;
|
||||
vertical-align: super;
|
||||
font-size: 50%;
|
||||
font-size: 60%;
|
||||
content: " *";
|
||||
text-shadow: 0 0 2px #b30000;
|
||||
}
|
||||
.form-group.span-full {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -99,8 +99,9 @@ label {
|
|||
> label:after {
|
||||
color: @color-form-required-asterisk;
|
||||
vertical-align: super;
|
||||
font-size: 50%;
|
||||
font-size: 60%;
|
||||
content: " *";
|
||||
text-shadow: 0 0 2px darken(@color-form-required-asterisk, 15%);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -487,6 +487,12 @@ class Form extends WidgetBase
|
|||
*/
|
||||
$field->value = $this->getFieldValue($field);
|
||||
|
||||
/*
|
||||
* Check model if field is required
|
||||
*/
|
||||
if (!$field->required && $this->model && method_exists($this->model, 'isAttributeRequired'))
|
||||
$field->required = $this->model->isAttributeRequired($field->columnName);
|
||||
|
||||
/*
|
||||
* Get field options from model
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
<?php if ($field->label): ?>
|
||||
<label for="<?= $field->getId() ?>">
|
||||
<?= e(trans($field->label)) ?>
|
||||
<?= ($field->required ? '*' : '') ?>
|
||||
</label>
|
||||
<?php endif ?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue