Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js	(revision 2774)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js	(revision 2775)
@@ -31,4 +31,27 @@
 	};
 
+	// Function called in onShow to load selected element.
+	var loadLink = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editObj = element;
+		this.editMode = true;
+
+		// Fill out all fields.
+		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
+		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
+		readAttribute.apply( this, [ 'info', 'checked', 'cmbSelected' ] );
+
+		return false;
+	};
+	
+	var readAttribute = function( page, attribute, input )
+	{
+		var attributeValue = this.editObj.getAttribute( attribute );
+		this.setValueOf( page, input, attributeValue );
+
+		return attributeValue;
+	}
+
 	return {
 		title : editor.lang.checkboxProp,
@@ -40,10 +63,11 @@
 			this.changedAttibutes[ 'type' ] = 'checkbox';
 
-			for ( var name in this.changedAttibutes )
-				this.editObj.setAttribute( name, this.changedAttibutes[ name ] );
+			this.editObj.setAttributes( this.changedAttibutes );
 
 			if ( this.editMode == false )
 			{
+				// It doesn't work with IE.
 				this.restoreSelection();
+				this.clearSavedSelection();
 				editor.insertElement( this.editObj );
 			}
@@ -52,10 +76,27 @@
 		onShow : function()
 		{
+			// Default: create a new element.
 			this.editMode = false;
+			
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
 
-			/*
-			Check selection.
-			Fill this.editObj if the BUTTON element is selected.
-			*/
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+				
+			// Check selection. Fill in all the relevant fields if there's already one link selected.
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
+
+				var rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'input', true );
+				if ( element && element.getAttribute( 'type' ) == "checkbox" )
+				{
+					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( element );
+				}
+			}
 
 			if ( this.editMode == false )	//New object.
@@ -100,9 +141,10 @@
 						type : 'checkbox',
 						label : editor.lang.dlgCheckboxSelected,
-						'default' : 'url',
+						'default' : '',
 						accessKey : 'S',
+						value : "checked",
 						validate: function()
 						{
-							addChange( 'selected', this );
+							addChange( 'checked', this );
 							return true;
 						}
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js	(revision 2774)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js	(revision 2775)
@@ -31,4 +31,27 @@
 	};
 
+	// Function called in onShow to load selected element.
+	var loadLink = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editObj = element;
+		this.editMode = true;
+
+		// Fill out all fields.
+		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
+		readAttribute.apply( this, [ 'info', 'action', 'txtAction' ] );
+		readAttribute.apply( this, [ 'info', 'method', 'cmbMethod' ] );
+
+		return false;
+	};
+	
+	var readAttribute = function( page, attribute, input )
+	{
+		var attributeValue = this.editObj.getAttribute( attribute );
+		this.setValueOf( page, input, attributeValue );
+
+		return attributeValue;
+	}
+
 	return {
 		title : editor.lang.formProp,
@@ -38,10 +61,11 @@
 		onOk : function( data )
 		{
-			for ( var name in this.changedAttibutes )
-				this.editObj.setAttribute(name, this.changedAttibutes[ name ] );
+			this.editObj.setAttributes( this.changedAttibutes );
 
-			if ( this.editMode == false )	//New object.
+			if ( this.editMode == false )
 			{
+				// It doesn't work with IE.
 				this.restoreSelection();
+				this.clearSavedSelection();
 				editor.insertElement( this.editObj );
 			}
@@ -50,11 +74,27 @@
 		onShow : function()
 		{
+			// Default: create a new element.
+			this.editMode = false;
+			
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
 
-			this.editMode = false;
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+				
+			// Check selection. Fill in all the relevant fields if there's already one link selected.
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
 
-			/*
-			Check selection.
-			Fill this.editObj if FORM element is selected.
-			*/
+				var rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'form', true );
+				if ( element )
+				{
+					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( element );
+				}
+			}
 
 			if( this.editMode == false )
@@ -96,5 +136,5 @@
 					},
 					{
-						id : 'txtMethod',
+						id : 'cmbMethod',
 						type : 'select',
 						label : editor.lang.dlgFormMethod,
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js	(revision 2774)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js	(revision 2775)
@@ -31,4 +31,26 @@
 	};
 
+	// Function called in onShow to load selected element.
+	var loadLink = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editObj = element;
+		this.editMode = true;
+
+		// Fill out all fields.
+		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
+		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
+
+		return false;
+	};
+	
+	var readAttribute = function( page, attribute, input )
+	{
+		var attributeValue = this.editObj.getAttribute( attribute );
+		this.setValueOf( page, input, attributeValue );
+
+		return attributeValue;
+	}
+
 	return {
 		title : editor.lang.hiddenFieldProp,
@@ -39,10 +61,12 @@
 		{
 			this.changedAttibutes[ 'type' ] = 'hidden';
-			for ( var name in this.changedAttibutes )
-				this.editObj.setAttribute(name, this.changedAttibutes[ name ] );
 
-			if( this.editMode == false )
+			this.editObj.setAttributes( this.changedAttibutes );
+
+			if ( this.editMode == false )
 			{
+				// It doesn't work with IE.
 				this.restoreSelection();
+				this.clearSavedSelection();
 				editor.insertElement( this.editObj );
 			}
@@ -51,10 +75,27 @@
 		onShow : function()
 		{
+			// Default: create a new element.
 			this.editMode = false;
+			
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
 
-			/*
-			Check selection.
-			Fill this.editObj if the BUTTON element is selected.
-			*/
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+				
+			// Check selection. Fill in all the relevant fields if there's already one link selected.
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
+
+				var rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'input', true );
+				if ( element && element.getAttribute( 'type' ) == "hidden" )
+				{
+					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( element );
+				}
+			}
 
 			if( this.editMode == false )	//New object.
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js	(revision 2774)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js	(revision 2775)
@@ -31,4 +31,27 @@
 	};
 
+	// Function called in onShow to load selected element.
+	var loadLink = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editObj = element;
+		this.editMode = true;
+
+		// Fill out all fields.
+		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
+		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
+		readAttribute.apply( this, [ 'info', 'checked', 'cmbSelected' ] );
+
+		return false;
+	};
+	
+	var readAttribute = function( page, attribute, input )
+	{
+		var attributeValue = this.editObj.getAttribute( attribute );
+		this.setValueOf( page, input, attributeValue );
+
+		return attributeValue;
+	}
+
 	return {
 		title : editor.lang.radioButtonProp,
@@ -40,10 +63,11 @@
 			this.changedAttibutes[ 'type' ] = 'radio';
 
-			for ( var name in this.changedAttibutes )
-				this.editObj.setAttribute(name, this.changedAttibutes[ name ] );
+			this.editObj.setAttributes( this.changedAttibutes );
 
-			if( this.editMode == false )
+			if ( this.editMode == false )
 			{
+				// It doesn't work with IE.
 				this.restoreSelection();
+				this.clearSavedSelection();
 				editor.insertElement( this.editObj );
 			}
@@ -52,10 +76,27 @@
 		onShow : function()
 		{
+			// Default: create a new element.
 			this.editMode = false;
+			
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
 
-			/*
-			Check selection.
-			Fill this.editObj if the RADIO element is selected.
-			*/
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+				
+			// Check selection. Fill in all the relevant fields if there's already one link selected.
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
+
+				var rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'input', true );
+				if ( element && element.getAttribute( 'type' ) == "radio" )
+				{
+					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( element );
+				}
+			}
 
 			if( this.editMode == false )	//New object.
@@ -97,12 +138,13 @@
 					},
 					{
-						id : 'txtSelected',
+						id : 'cmbSelected',
 						type : 'checkbox',
 						label : editor.lang.dlgCheckboxSelected,
-						'default' : 'url',
+						'default' : '',
 						accessKey : 'S',
+						value : "checked",
 						validate: function()
-						{
-							addChange( 'selected', this );
+						{							
+							addChange( 'checked', this );
 							return true;
 						}
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js	(revision 2774)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js	(revision 2775)
@@ -31,4 +31,27 @@
 	};
 
+	// Function called in onShow to load selected element.
+	var loadLink = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editObj = element;
+		this.editMode = true;
+
+		// Fill out all fields.
+		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
+		readAttribute.apply( this, [ 'info', 'cols', 'txtColumns' ] );
+		readAttribute.apply( this, [ 'info', 'rows', 'txtRows' ] );
+
+		return false;
+	};
+	
+	var readAttribute = function( page, attribute, input )
+	{
+		var attributeValue = this.editObj.getAttribute( attribute );
+		this.setValueOf( page, input, attributeValue );
+
+		return attributeValue;
+	}
+
 	return {
 		title : editor.lang.extareaProp,
@@ -38,10 +61,11 @@
 		onOk : function( data )
 		{
-			for ( var name in this.changedAttibutes )
-				this.editObj.setAttribute(name, this.changedAttibutes[ name ] );
+			this.editObj.setAttributes( this.changedAttibutes );
 
 			if ( this.editMode == false )
 			{
+				// It doesn't work with IE.
 				this.restoreSelection();
+				this.clearSavedSelection();
 				editor.insertElement( this.editObj );
 			}
@@ -50,10 +74,27 @@
 		onShow : function()
 		{
+			// Default: create a new element.
 			this.editMode = false;
+			
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
 
-			/*
-			Check selection.
-			Fill this.editObj if the TEXTAREA element is selected.
-			*/
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+				
+			// Check selection. Fill in all the relevant fields if there's already one link selected.
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
+
+				var rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'textarea', true );
+				if ( element )
+				{
+					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( element );
+				}
+			}
 
 			if ( this.editMode == false )	//New object.
@@ -91,15 +132,9 @@
 						validate: function()
 						{
-							if ( this.getValue() != '' )
-							{
-								var maxChars = parseInt( this.getValue(), 10 );
-								if ( isNaN( maxChars ) )
-								{
-									this.select();
-									return false;
-								}
+							var func = CKEDITOR.dialog.validate.integer( editor.lang.dlgImgTypeNumber );
+							var isValid = func.apply( this );
+							if ( isValid )
 								addChange( 'cols', this );
-							}
-							return true;
+							return isValid;
 						}
 					},
@@ -113,15 +148,9 @@
 						validate: function()
 						{
-							if ( this.getValue() != '' )
-							{
-								var charWidth = parseInt( this.getValue(), 10 );
-								if ( isNaN( charWidth ) )
-								{
-									this.select();
-									return false;
-								}
+							var func = CKEDITOR.dialog.validate.integer( editor.lang.dlgImgTypeNumber );
+							var isValid = func.apply( this );
+							if ( isValid )
 								addChange( 'rows', this );
-							}
-							return true;
+							return isValid;
 						}
 					}
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js	(revision 2774)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js	(revision 2775)
@@ -31,4 +31,29 @@
 	};
 
+	// Function called in onShow to load selected element.
+	var loadLink = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editObj = element;
+		this.editMode = true;
+
+		// Fill out all fields.
+		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
+		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
+		readAttribute.apply( this, [ 'info', 'type', 'cmbType' ] );
+		readAttribute.apply( this, [ 'info', 'width', 'txtTextCharWidth' ] );
+		readAttribute.apply( this, [ 'info', 'maxlength', 'txtMaxChars' ] );
+
+		return false;
+	};
+	
+	var readAttribute = function( page, attribute, input )
+	{
+		var attributeValue = this.editObj.getAttribute( attribute );
+		this.setValueOf( page, input, attributeValue );
+
+		return attributeValue;
+	}
+	
 	return {
 		title : editor.lang.textFieldProp,
@@ -38,12 +63,11 @@
 		onOk : function()
 		{
-			for ( var name in this.changedAttibutes )
-			{
-				this.editObj.setAttribute( name, this.changedAttibutes[ name ] );
-			}
+			this.editObj.setAttributes( this.changedAttibutes );
 
 			if ( this.editMode == false )
 			{
+				// It doesn't work with IE.
 				this.restoreSelection();
+				this.clearSavedSelection();
 				editor.insertElement( this.editObj );
 			}
@@ -52,15 +76,34 @@
 		onShow : function()
 		{
+			// Default: create a new element.
 			this.editMode = false;
-
-			/*
-			Check selection.
-			Fill this.editObj if the BUTTON element is selected.
-			*/
+			
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
+
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+				
+			// Check selection. Fill in all the relevant fields if there's already one link selected.
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
+
+				var rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'input', true );
+				if ( element )
+				{
+					var type = element.getAttribute( 'type' );
+					if ( type == "text" || type == null )
+					{
+						loadLink.apply( this, [ editor, selection, ranges, element ] );
+						selection.selectElement( element );
+					}
+				}
+			}
 
 			if ( this.editMode == false )	//New object.
-			{
 				this.editObj = editor.document.createElement( 'input' );
-			}
 
 			this.getContentElement( 'info', 'txtName' ).focus();
@@ -119,15 +162,9 @@
 								validate: function()
 								{
-									if ( this.getValue() != '' )
-									{
-										var charWidth = parseInt( this.getValue(), 10 );
-										if ( isNaN( charWidth ) )
-										{
-											this.select();
-											return false;
-										}
+									var func = CKEDITOR.dialog.validate.integer( editor.lang.dlgImgTypeNumber );
+									var isValid = func.apply( this );
+									if ( isValid )
 										addChange( 'width', this );
-									}
-									return true;
+									return isValid;
 								}
 							},
@@ -141,15 +178,9 @@
 								validate: function()
 								{
-									if ( this.getValue() != '' )
-									{
-										var maxChars = parseInt( this.getValue(), 10 );
-										if ( isNaN( maxChars ) )
-										{
-											this.select();
-											return false;
-										}
+									var func = CKEDITOR.dialog.validate.integer( editor.lang.dlgImgTypeNumber );
+									var isValid = func.apply( this );
+									if ( isValid )
 										addChange( 'maxlength', this );
-									}
-									return true;
+									return isValid;
 								}
 							}
@@ -157,5 +188,5 @@
 					},
 					{
-						id : 'txtType',
+						id : 'cmbType',
 						type : 'select',
 						label : editor.lang.dlgTextType,
@@ -167,5 +198,5 @@
 							[ editor.lang.dlgTextTypePass, 'pass' ],
 						],
-						validate: function( data )
+						validate: function()
 						{
 							addChange( 'type', this );
