added a commit callback for short circuiting the survey commit
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 May 2005 17:28:52 +0000 (17:28 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 May 2005 17:28:52 +0000 (17:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@709 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/widgets/Survey.js

index c0dc2d1..fe355ab 100644 (file)
@@ -159,6 +159,23 @@ Survey.prototype.setSubmitCallback = function(callback) {
 Survey.prototype.submit = function() {
 
        var responses = this.buildSurveyResponse();
+
+       if( this.commitCallback) {
+               this.commitCallback(responses);
+
+       } else {
+               this.commit(responses);
+       }
+       
+       var bool = true;
+       if( this.submitCallback )
+               bool = this.submitCallback(this);
+       
+       this.removeFooter();
+
+}
+
+Survey.prototype.commit = function(responses) {
        var method;
        if( this.userId ) 
                method = "open-ils.circ.survey.submit.user_id";
@@ -175,15 +192,9 @@ Survey.prototype.submit = function() {
 
        /* there is nothing to return, just check for exceptions */
        request.getResultObject();
-
-       var bool = true;
-       if( this.submitCallback )
-               bool = this.submitCallback(this);
-
-       this.removeFooter();
-
 }
 
+
 Survey.prototype.buildSurveyResponse = function() {
 
        var responses = new Array();