From: Tara L Andrews Date: Thu, 14 Jun 2012 17:08:09 +0000 (+0200) Subject: properly disable OK button X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc028ff38b3c5b095277d78d2be7d3a1b1f12634;p=scpubgit%2Fstemmatology.git properly disable OK button --- diff --git a/stemmaweb/root/js/relationship.js b/stemmaweb/root/js/relationship.js index b865e9c..6d8f242 100644 --- a/stemmaweb/root/js/relationship.js +++ b/stemmaweb/root/js/relationship.js @@ -647,11 +647,11 @@ $(document).ready(function () { width: 290, modal: true, buttons: { - "Ok": function() { + "Ok": function( evt ) { + $(evt.target).button("disable"); $('#status').empty(); form_values = $('#collapse_node_form').serialize(); ncpath = getTextURL( 'relationships' ); - $(':button :contains("Ok")').attr("disabled", true); var jqjson = $.post( ncpath, form_values, function(data) { $.each( data, function(item, source_target) { var source_found = get_ellipse( source_target[0] ); @@ -663,7 +663,8 @@ $(document).ready(function () { relation.data( 'note', $('#note').val() ); relation_manager.toggle_active( relation.attr('id') ); } - }); + $(evt.target).button("enable"); + }); $( "#dialog-form" ).dialog( "close" ); }, 'json' ); }, @@ -705,6 +706,7 @@ $(document).ready(function () { && ajaxSettings.type == 'POST' && jqXHR.status == 403 ) { var errobj = jQuery.parseJSON( jqXHR.responseText ); $('#status').append( '

Error: ' + errobj.error + '
The relationship cannot be made.

' ); + $(event.target).parent().find('.ui-button').button("enable"); } } );