From ca1e1d0489db6c4946cdca9119dfc2db2db68309 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 22 Jun 2010 22:12:32 +0000 Subject: [PATCH] NIHVIVO-646 more work on javascript for add authors to publication form --- webapp/web/js/customFormUtils.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/webapp/web/js/customFormUtils.js b/webapp/web/js/customFormUtils.js index c4c4ae5b0..2458121a7 100644 --- a/webapp/web/js/customFormUtils.js +++ b/webapp/web/js/customFormUtils.js @@ -31,5 +31,30 @@ vitro.customFormUtils = { // the markup, for customized positioning, in which case we will empty them // but not remove them here. See findValidationErrors(). el.find('.validationError').remove(); - } + }, + + // Return true iff there are validation errors on the form + findValidationErrors: function() { + + return this.form.find('.validationError').length > 0; + +// RY For now, we just need to look for the presence of the error elements. +// Later, however, we may generate empty error messages in the markup, for +// customized positioning, in which case we need to look for whether they have +// content. See clearFormData(). +// var foundErrors = false, +// errors = this.form.find('.validationError'), +// numErrors = errors.length, +// i, +// error; +// +// for (i = 0; foundErrors == false && i < numErrors; i++) { +// error = errors[i]; +// if (error.html() != '') { +// foundErrors = true; +// } +// } +// +// return foundErrors; + }, } \ No newline at end of file