--- loncom/homework/structuretags.pm 2014/05/18 02:13:45 1.519 +++ loncom/homework/structuretags.pm 2014/09/14 15:21:43 1.520 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.519 2014/05/18 02:13:45 raeburn Exp $ +# $Id: structuretags.pm,v 1.520 2014/09/14 15:21:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -254,6 +254,32 @@ function image_response_click (which, e) input_element.value = click; img_element.src = '/adm/randomlabel.png?token='+token+'&clickdata='+click; } + +var submithandled = 0; + +$(document).ready(function(){ + $(document).delegate('form :submit', 'click', function( event ) { + if ( $( this ).hasClass( "LC_hwk_submit" ) ) { + var buttonId = this.id; + if (submithandled == 0) { + submithandled = 1; + $( "#msg_"+buttonId ).css({"display": "inline","background-color": "#87cefa", + "color": "black","padding": "2px"}) ; + $( ".LC_status_"+buttonId ).hide(); + if (( $(this.form).id == "LC_page" ) && ($('input[name="all_submit"]').length )) { + if (( "#"+buttonId+"_pressed" ).length) { + $( "#"+buttonId+"_pressed" ).val( "1" ); + } + } + $(this.form).submit(); + $( this ).attr( "disabled", true); + event.preventDefault(); + return true; + } + } + }); +}); + // ]]> JS