[richfaces-svn-commits] JBoss Rich Faces SVN: r11948 - trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sat Dec 20 10:50:14 EST 2008


Author: nbelaevski
Date: 2008-12-20 10:50:14 -0500 (Sat, 20 Dec 2008)
New Revision: 11948

Modified:
   trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
https://jira.jboss.org/jira/browse/RF-3856

Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js	2008-12-20 15:31:03 UTC (rev 11947)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js	2008-12-20 15:50:14 UTC (rev 11948)
@@ -161,6 +161,21 @@
 		this.selectBehavior = options.selectBehavior;
 	},
 
+	_saveInputValues: function(element) {
+		/* Fix for RF-3856 - Checkboxes in modal panel does not hold their states after modal was closed and opened again */
+		if (Prototype.Browser.IE /* reproducible for checkbox/radio in IE6, radio in IE 7/8 beta 2 */) {
+			var inputs = element.getElementsByTagName('input');
+			if (inputs) {
+				for (var i = 0; i < inputs.length; i++) {
+					var input = inputs[i];
+					if (input.type == 'checkbox' || input.type == 'radio') {
+						input.defaultChecked = input.checked;
+					}
+				}
+			}
+		}
+	},
+	
 	width: function() {
 		return this.getSizedElement().clientWidth;
 	},
@@ -397,14 +412,11 @@
 	formElements: "|a|input|select|button|textarea|",
 	
 	processAllFocusElements: function(root, callback) {
-		if (root.nodeType==1) {
-			var tagName = root.tagName.toLowerCase();
-			if (root.focus && 
-				// Many not visible elements have focus method, we is had to avoid processing them.
-				this.formElements.indexOf(tagName)!=-1 &&
-				!root.disabled && root.type!="hidden") {
-					callback.call(this, root);
-			}
+		if (root.focus && root.nodeType == 1 && root.tagName &&
+			// Many not visible elements have focus method, we is had to avoid processing them.
+			this.formElements.indexOf(root.tagName.toLowerCase())!=-1 &&
+			!root.disabled && root.type!="hidden") {
+				callback.call(this, root);
 		} else {
 			if (root != this.id) {
 				var child = root.firstChild;
@@ -477,6 +489,7 @@
 			
 	        if (!this.floatedToBody) {
 				this.parent = element.parentNode;
+				this._saveInputValues(element);
 				document.body.insertBefore(this.parent.removeChild(element), null);
 				this.floatedToBody = true;
 			}
@@ -719,7 +732,7 @@
 			Element.hide(element);
 	
 			if (this.floatedToBody && this.parent) {
-				
+				this._saveInputValues(element);
 				document.body.removeChild(element);
 				this.parent.appendChild(element);
 				this.floatedToBody = false;




More information about the richfaces-svn-commits mailing list