Merge "Show an asterisk mark for 'switched' conditional filed(required=Flase)"
This commit is contained in:
commit
aecde4eecd
|
@ -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