Show an asterisk mark for 'switched' conditional filed(required=Flase)
Change-Id: I80dbd4b6aa9f3adeaf508b05f878b9f11cacf80a Partial-Bug: #1755131
This commit is contained in:
parent
ec14dd91bd
commit
0efbb377a5
|
@ -523,6 +523,11 @@ horizon.addInitFunction(horizon.forms.init = function () {
|
|||
$input.attr("required", "required");
|
||||
}
|
||||
}
|
||||
if ($input.data("required-when-shown") === true &&
|
||||
$input.closest('.form-group').find('.hz-icon-required').length < 1) {
|
||||
var asterist_text = '<span class="hz-icon-required fa fa-asterisk"></span>';
|
||||
$input.closest('.form-group').children('.control-label').after(asterist_text);
|
||||
}
|
||||
}
|
||||
|
||||
$fieldset.find('.switched[data-switch-on*="' + slug + '"]').each(handle_switched_field);
|
||||
|
|
|
@ -307,6 +307,7 @@ class AttachInterface(forms.SelfHandlingForm):
|
|||
required=False,
|
||||
widget=forms.ThemableSelectWidget(attrs={
|
||||
'class': 'switched',
|
||||
'data-required-when-shown': 'true',
|
||||
'data-switch-on': 'specification_method',
|
||||
'data-specification_method-network': _('Network'),
|
||||
}))
|
||||
|
|
Loading…
Reference in New Issue