diff --git a/src/main/webapp/scripts/xnat/xhr.js b/src/main/webapp/scripts/xnat/xhr.js index 5f3754f454586e43ae23df97e3831e790f828e41..b6acb28092ac46116198767b0ee129c3c5b28ec4 100755 --- a/src/main/webapp/scripts/xnat/xhr.js +++ b/src/main/webapp/scripts/xnat/xhr.js @@ -578,16 +578,17 @@ var XNAT = getObject(XNAT||{}), // stop here if there are errors if (errors.length) { console.log('ERRORS: ' + errors); - // errors = errors.map(function(field){ - // return '<li>' + field + '</li>' - // }); - // xmodal.message({ - // title: 'Validation Failed', - // content: '' + - // '<p>Please correct errors with the following fields:</p> ' + - // '<ul>' + errors.join('') + '</ul>' - // }); - // return false; + // VALIDATION ERRORS WILL STOP FORM SUBMISSION + errors = errors.map(function(field){ + return '<li>' + field + '</li>' + }); + xmodal.message({ + title: 'Validation Failed', + content: '' + + '<p>Please correct errors with the following fields:</p> ' + + '<ul>' + errors.join('') + '</ul>' + }); + return false; } var inputs = $inputs.toArray(); @@ -636,7 +637,7 @@ var XNAT = getObject(XNAT||{}), $.fn.submitJSON = function(opts){ var $form = $(this); $form.addClass('json'); - return xhr.form(this, extend(true, { + return xhr.form($form, extend(true, { method: $form.data('method') || this.method || 'POST', processData: false, contentType: 'application/json'