Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2499)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2500)
@@ -330,7 +330,13 @@
 			onClick : function( evt )
 			{
-				var ret = evt.data.dialog.fire( 'ok', { hide : true } ).hide;
+				var dialog = evt.data.dialog,
+					ret = dialog.fire( 'ok', { hide : true } ).hide;
+				for ( var i in dialog._.contents )
+				{
+					if ( dialog._.contents[i].validate && !dialog._.contents[i].validate( dialog ) )
+						ret = false;
+				}
 				if ( ret !== false )
-					evt.data.dialog.hide();
+					dialog.hide();
 			}
 		},
@@ -354,5 +360,5 @@
 				}
 				if ( ret !== false )
-					evt.data.dialog.hide();
+					dialog.hide();
 			}
 		},
@@ -430,5 +436,15 @@
 										title : 'Your love is like bad medicine!',
 										id : 'testText4',
-										'default' : 'hello world!'
+										'default' : 'hello world!',
+										validate : function( dialog )
+										{
+											var valid = /^[A-Z a-z!]+$/.test( this.getValue() );
+											if ( !valid )
+											{
+												alert( 'Test Text 4 must only contain alphanumeric characters, space, or ! and must not be empty.' );
+												this.focus();
+											}
+											return valid;
+										}
 									},
 
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2499)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2500)
@@ -134,4 +134,8 @@
 					attributes.style = styleStr.join( '; ' );
 
+				// Set the validator, if any.
+				if ( elementDefinition.validate )
+					this.validate = elementDefinition.validate;
+
 				var innerHTML = function()
 				{
@@ -152,4 +156,7 @@
 				var _ = initPrivateObject.call( this, elementDefinition );
 				this._['default'] = elementDefinition.checked || false;
+
+				if ( elementDefinition.validate )
+					this.validate = elementDefinition.validate();
 
 				var innerHTML = function()
@@ -181,4 +188,6 @@
 				if ( !( 'default' in this._ ) )
 					this._['default'] = elementDefinition.items[0][1] ;
+				if ( elementDefinition.validate )
+					this.validate = elementDefinition.valdiate;
 				var children = [];
 
@@ -336,5 +345,4 @@
 				setValue : function( value )
 				{
-					console.log( 'Radio button... children length=' + this._.children.length );
 					var children = this._.children,
 						item;
