Added 'always-enabled' submit button selector
In case when we do not want to disable a form button after form submit, it can be marked as <input class="always-enabled">. Fixes bug 1011527 Change-Id: I176844a3c69cdf260cb40a6574ae34b6a36ee2a0
This commit is contained in:
parent
40e34c3000
commit
bd0bf100a2
@ -20,6 +20,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Download EC2 Credentials" %}" />
|
||||
<input class="btn btn-primary pull-right always-enabled" type="submit" value="{% trans "Download EC2 Credentials" %}" />
|
||||
{% if hide %}<a href="{% url horizon:settings:ec2:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -27,6 +27,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<button class="btn btn-primary pull-right" type="submit">{% trans "Download RC File" %}</button>
|
||||
<button class="btn btn-primary pull-right always-enabled" type="submit">{% trans "Download RC File" %}</button>
|
||||
{% if hide %}<a href="{% url horizon:settings:project:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -17,11 +17,14 @@ horizon.forms = {
|
||||
horizon.addInitFunction(function () {
|
||||
// Disable multiple submissions when launching a form.
|
||||
$("form").submit(function () {
|
||||
$(this).submit(function () {
|
||||
var button = $(this).find('[type="submit"]');
|
||||
if (button.length && !button.hasClass('always-enabled')){
|
||||
$(this).submit(function () {
|
||||
return false;
|
||||
});
|
||||
$('input:submit').removeClass('primary').addClass('disabled');
|
||||
$('input:submit').attr('disabled', 'disabled');
|
||||
});
|
||||
button.removeClass('primary').addClass('disabled');
|
||||
button.attr('disabled', 'disabled');
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user