From 8d23310bd2f9abb32cd9561ce0aa9c505cfa9cb1 Mon Sep 17 00:00:00 2001 From: Aaron Newton Date: Sun, 8 Mar 2009 16:53:00 -0700 Subject: [PATCH] checking for Fx.Scroll before it is invoked in FormValidator.Inline --- Source/Forms/FormValidator.Inline.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Source/Forms/FormValidator.Inline.js b/Source/Forms/FormValidator.Inline.js index f71a19e6..537c5e06 100644 --- a/Source/Forms/FormValidator.Inline.js +++ b/Source/Forms/FormValidator.Inline.js @@ -40,19 +40,16 @@ FormValidator.Inline = new Class({ makeAdvice: function(className, field, error, warn){ var errorMsg = (warn)?this.warningPrefix:this.errorPrefix; errorMsg += (this.options.useTitles) ? field.title || error:error; + var cssClass = (warn)?'warning-advice':'validation-advice'; + var newAdvice = new Element('div', { + html: errorMsg, + styles: { display: 'none' }, + id: 'advice-'+className+'-'+this.getFieldId(field) + }).addClass(cssClass); var advice = this.getAdvice(className, field); - if (!advice){ - var cssClass = (warn) ? 'warning-advice' : 'validation-advice'; - advice = new Element('div', { - html: errorMsg, - styles: { display: 'none' }, - id: 'advice-' + className + '-' + this.getFieldId(field) - }).addClass(cssClass); - } else{ - advice.set('html', errorMsg); - } - field.store('advice-' + className, advice); - return advice; + if(advice) newAdvice.replaces(advice); + field.store('advice-'+className, newAdvice); + return newAdvice; }, getFieldId : function(field){ @@ -146,7 +143,7 @@ FormValidator.Inline = new Class({ par = par.getParent(); }; var fx = par.retrieve('fvScroller'); - if (!fx && window.Fx){ + if (!fx && window.Fx && Fx.Scroll){ fx = new Fx.Scroll(par, { transition: 'quad:out', offset: {