[pLog-svn] r5780 - plog/trunk/js/ui

oscar at devel.lifetype.net oscar at devel.lifetype.net
Fri Aug 3 18:02:58 EDT 2007


Author: oscar
Date: 2007-08-03 18:02:58 -0400 (Fri, 03 Aug 2007)
New Revision: 5780

Modified:
   plog/trunk/js/ui/forms.js
Log:
Small fix in case responseText.form is not available


Modified: plog/trunk/js/ui/forms.js
===================================================================
--- plog/trunk/js/ui/forms.js	2007-08-03 20:15:43 UTC (rev 5779)
+++ plog/trunk/js/ui/forms.js	2007-08-03 22:02:58 UTC (rev 5780)
@@ -248,21 +248,23 @@
 				// was it successful?
 				if( response.success == false ) {							
 					// process the information from the 'form' object
-					for( i = 0; i < form.fields.length; i++ ) {
-						fObject = form.fields[i];
-						// is the field valid?
-						if( fObject.valid == false ) {
-							// We've also got the name of the field that caused the error and 
-							// the error message that should be displayed, so we can do it right away
-							if(( elem = YAHOO.util.Dom.get( "field_" + fObject.field ))) {
-								elem.style.display = 'block';
-								elem.innerHTML = '<span style="background:red;color:white;font-weight:bold">&nbsp;!&nbsp;</span>&nbsp;' + fObject.message;
+					if( form != undefined ) {
+						for( i = 0; i < form.fields.length; i++ ) {
+							fObject = form.fields[i];
+							// is the field valid?
+							if( fObject.valid == false ) {
+								// We've also got the name of the field that caused the error and 
+								// the error message that should be displayed, so we can do it right away
+								if(( elem = YAHOO.util.Dom.get( "field_" + fObject.field ))) {
+									elem.style.display = 'block';
+									elem.innerHTML = '<span style="background:red;color:white;font-weight:bold">&nbsp;!&nbsp;</span>&nbsp;' + fObject.message;
+								}
 							}
-						}
-						else {
-							// there was no error, so we can hide the error message if there was one previously displayed
-							if(( elem = YAHOO.util.Dom.get( "field_" + fObject.field ))) {
-								elem.style.display = 'none';
+							else {
+								// there was no error, so we can hide the error message if there was one previously displayed
+								if(( elem = YAHOO.util.Dom.get( "field_" + fObject.field ))) {
+									elem.style.display = 'none';
+								}
 							}
 						}
 					}



More information about the pLog-svn mailing list