diff --git a/horizon/static/horizon/js/horizon.forms.js b/horizon/static/horizon/js/horizon.forms.js index 253275e036..12fe63a95b 100644 --- a/horizon/static/horizon/js/horizon.forms.js +++ b/horizon/static/horizon/js/horizon.forms.js @@ -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 = ''; + $input.closest('.form-group').children('.control-label').after(asterist_text); + } } $fieldset.find('.switched[data-switch-on*="' + slug + '"]').each(handle_switched_field); diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py index 0b72844b17..71b7295276 100644 --- a/openstack_dashboard/dashboards/project/instances/forms.py +++ b/openstack_dashboard/dashboards/project/instances/forms.py @@ -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'), }))