Skip to content
Snippets Groups Projects
Commit 1c88896d authored by Mark M. Florida's avatar Mark M. Florida
Browse files

XNAT-4242: form validation errors will stop submission and display a dialog...

XNAT-4242: form validation errors will stop submission and display a dialog listing fields that need to be corrected.
parent 26367afb
No related branches found
No related tags found
No related merge requests found
...@@ -578,16 +578,17 @@ var XNAT = getObject(XNAT||{}), ...@@ -578,16 +578,17 @@ var XNAT = getObject(XNAT||{}),
// stop here if there are errors // stop here if there are errors
if (errors.length) { if (errors.length) {
console.log('ERRORS: ' + errors); console.log('ERRORS: ' + errors);
// errors = errors.map(function(field){ // VALIDATION ERRORS WILL STOP FORM SUBMISSION
// return '<li>' + field + '</li>' errors = errors.map(function(field){
// }); return '<li>' + field + '</li>'
// xmodal.message({ });
// title: 'Validation Failed', xmodal.message({
// content: '' + title: 'Validation Failed',
// '<p>Please correct errors with the following fields:</p> ' + content: '' +
// '<ul>' + errors.join('') + '</ul>' '<p>Please correct errors with the following fields:</p> ' +
// }); '<ul>' + errors.join('') + '</ul>'
// return false; });
return false;
} }
var inputs = $inputs.toArray(); var inputs = $inputs.toArray();
...@@ -636,7 +637,7 @@ var XNAT = getObject(XNAT||{}), ...@@ -636,7 +637,7 @@ var XNAT = getObject(XNAT||{}),
$.fn.submitJSON = function(opts){ $.fn.submitJSON = function(opts){
var $form = $(this); var $form = $(this);
$form.addClass('json'); $form.addClass('json');
return xhr.form(this, extend(true, { return xhr.form($form, extend(true, {
method: $form.data('method') || this.method || 'POST', method: $form.data('method') || this.method || 'POST',
processData: false, processData: false,
contentType: 'application/json' contentType: 'application/json'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment