#4029 On the fly form validation works in Opera as well (from r111880)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112936 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 05:03:47 +00:00
parent f51f5bc958
commit 3c681b0324

View File

@ -1,5 +1,6 @@
var _CURRENT_FORM; var _CURRENT_FORM;
var _FIRST_ERRORED_FIELD = null; var _FIRST_ERRORED_FIELD = null;
var _VALIDATIONS_REF = new Array();
function initialiseForm(form, fromAnOnBlur) { function initialiseForm(form, fromAnOnBlur) {
_CURRENT_FORM = form; _CURRENT_FORM = form;
@ -247,7 +248,7 @@ function validationError(field,message, messageClass, cacheError) {
_HAS_HAD_FORM_ERROR = true; _HAS_HAD_FORM_ERROR = true;
// See if the tag has a reference to the validationMessage (quicker than the one below) // See if the tag has a reference to the validationMessage (quicker than the one below)
var validationMessage = field.validationMessage; var validationMessage = (typeof(_VALIDATIONS_REF[field.id]) != 'undefined')? _VALIDATIONS_REF[field.id] : null;
// Cycle through the elements to see if it has a span // Cycle through the elements to see if it has a span
// (for a validation or required messages) // (for a validation or required messages)
@ -266,7 +267,7 @@ function validationError(field,message, messageClass, cacheError) {
} }
// Keep a reference to it // Keep a reference to it
field.validationMessage = validationMessage; _VALIDATIONS_REF[field.id] = validationMessage;
// Keep a reference to the first errored field // Keep a reference to the first errored field
if(field && !_FIRST_ERRORED_FIELD) _FIRST_ERRORED_FIELD = field; if(field && !_FIRST_ERRORED_FIELD) _FIRST_ERRORED_FIELD = field;