diff --git a/horizon/static/horizon/js/horizon.forms.js b/horizon/static/horizon/js/horizon.forms.js index 6f1cfe4f07..cec82559ad 100644 --- a/horizon/static/horizon/js/horizon.forms.js +++ b/horizon/static/horizon/js/horizon.forms.js @@ -320,25 +320,32 @@ horizon.addInitFunction(horizon.forms.init = function () { visible = $switchable.parent().hasClass('themable-checkbox') ? $switchable.siblings('label').is(':visible') : $switchable.is(':visible'), slug = $switchable.data('slug'), checked = $switchable.prop('checked'), - hide_tab = String($switchable.data('hide-tab')).split(','), hide_on = $switchable.data('hideOnChecked'); // If checkbox is hidden then do not apply any further logic if (!visible) return; // If the checkbox has hide-tab attribute then hide/show the tab - var i, len; - for (i = 0, len = hide_tab.length; i < len; i++) { + if ($switchable.data('hide-tab')){ + var hide_tab = String($switchable.data('hide-tab')).split(','); + for (var i = 0, len = hide_tab.length; i < len; i++) { + var tab = $('*[data-target="#'+ hide_tab[i] +'"]').parent(); + if(checked == hide_on) { + // If the checkbox is not checked then hide the tab + tab.hide(); + } else if (!tab.is(':visible')) { + // If the checkbox is checked and the tab is currently hidden then show the tab again + tab.show(); + } + } + + // hide/show button-next or button-final var $btnfinal = $('.button-final'); if(checked == hide_on) { - // If the checkbox is not checked then hide the tab - $('*[data-target="#'+ hide_tab[i] +'"]').parent().hide(); $('.button-next').hide(); $btnfinal.show(); $btnfinal.data('show-on-tab', $fieldset.prop('id')); - } else if (!$('*[data-target="#'+ hide_tab[i] +'"]').parent().is(':visible')) { - // If the checkbox is checked and the tab is currently hidden then show the tab again - $('*[data-target="#'+ hide_tab[i] +'"]').parent().show(); + } else{ $btnfinal.hide(); $('.button-next').show(); $btnfinal.removeData('show-on-tab'); diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py index bc68a18bb7..eee7b6db0d 100644 --- a/openstack_dashboard/dashboards/project/networks/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/workflows.py @@ -62,7 +62,7 @@ class CreateNetworkInfoAction(workflows.Action): 'action,' 'create_network__' 'createsubnetdetail' - 'action,', + 'action', 'data-hide-on-checked': 'false' }), initial=True, @@ -174,7 +174,7 @@ class CreateSubnetInfoAction(workflows.Action): label=_("Gateway IP"), widget=forms.TextInput(attrs={ 'class': 'switched', - 'data-switch-on': 'source gateway_ip', + 'data-switch-on': 'gateway_ip', 'data-source-manual': _("Gateway IP") }), required=False,