Commits

Scott Scites committed 5ef6192

Added more validation

  • Participants
  • Parent commits 1ba21dd

Comments (0)

Files changed (12)

+/home/scitess/code/django-nonrel/django/

File djangoappengine

+/home/scitess/code/djangoappengine/

File djangotoolbox

+/home/scitess/code/djangotoolbox/djangotoolbox/

File media/output/Blog.css

 
 .gwt-TextArea {
     width: 270px;
-    height: 250px;
+    height: 115px;
 }
 
 .gwt-TextBox {

File media/output/Blog.ie6.cache.html

 elem.onerror       = (bits & 0x10000) ? $wnd.__dispatchEvent:null;
 elem.oncontextmenu = (bits & 0x20000) ? $wnd.__dispatchEvent:null; 
 elem.onmousewheel  = (bits & 0x40000) ? $wnd.__dispatchEvent:null;
+elem.onpropertychange = (bits & 0x80000) ? $wnd.__dispatchEvent:null;
     
 	};
 	$m['sinkEvents'].__name__ = 'sinkEvents';
 
 			self['viewComponent']['clear_write_panel']();
 			self['viewComponent']['dialog']['show']();
+			self['viewComponent']['post_title']['setFocus'](true);
 			return null;
 		}
 	, 1, [null,null,['self'],['event']]);
 			} else {
 				var self = arguments[0];
 			}
-			var content,title;
+			var $add2,title,error_message,content,$add1;
+			error_message = '';
 			title = self['viewComponent']['post_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, title, $m.content]);
+				self['viewComponent']['post_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', title, $m.content]);
 			}
 			content = self['viewComponent']['post_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, title, content]);
-			}
-			return $p['tuple']([false, title, content]);
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add1='Post body must be less than 255 characters. It is ',$add2=$p['str']($p['len'](content))), title, content]);
+			}
+			return $p['tuple']([error_message, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_add'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var content,isEmpty,title;
+			var content,error_message,title;
 			var $tupleassign1 = self['validate_add']();
-			isEmpty = $tupleassign1.__getitem__(0);
+			error_message = $tupleassign1.__getitem__(0);
 			title = $tupleassign1.__getitem__(1);
 			content = $tupleassign1.__getitem__(2);
-			if ($p['bool']($p['op_eq'](isEmpty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			title = self['viewComponent']['post_title']['getText']();
 			self['viewComponent']['edit_title']['setText']((($attr61=($attr62=post)['title']) == null || (($attr62.__is_instance__) && typeof $attr61 == 'function') || (typeof $attr61['__get__'] == 'function')?
 						$p['getattr']($attr62, 'title'):
 						post['title']));
+			self['viewComponent']['edit_title']['setFocus'](true);
 			self['viewComponent']['edit_content']['setText']((($attr63=($attr64=post)['content']) == null || (($attr64.__is_instance__) && typeof $attr63 == 'function') || (typeof $attr63['__get__'] == 'function')?
 						$p['getattr']($attr64, 'content'):
 						post['content']));
 			} else {
 				var self = arguments[0];
 			}
-			var content,key,title;
+			var $add4,title,error_message,content,$add3,key;
+			error_message = '';
 			key = self['viewComponent']['edit_hidden_key']['getValue']();
 			if ($p['bool']($p['op_eq'](key, ''))) {
-				return $p['tuple']([true, key, $m.title, $m.content]);
+				return $p['tuple'](['Cannot update without a post identifier', key, $m.title, $m.content]);
 			}
 			title = self['viewComponent']['edit_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, key, title, $m.content]);
+				self['viewComponent']['edit_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', key, title, $m.content]);
 			}
 			content = self['viewComponent']['edit_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, key, title, content]);
-			}
-			return $p['tuple']([false, key, title, content]);
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', key, title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add3='Post body must be less than 255 characters. It is ',$add4=$p['str']($p['len'](content))), key, title, content]);
+			}
+			return $p['tuple']([error_message, key, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_edit'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var title,content,is_empty,key;
+			var title,error_message,content,key;
 			var $tupleassign2 = self['validate_edit']();
-			is_empty = $tupleassign2.__getitem__(0);
+			error_message = $tupleassign2.__getitem__(0);
 			key = $tupleassign2.__getitem__(1);
 			title = $tupleassign2.__getitem__(2);
 			content = $tupleassign2.__getitem__(3);
-			if ($p['bool']($p['op_eq'](is_empty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			self['edit_remote_proxy']['edit_remote_blog_post'](key, title, content);

File media/output/Blog.mozilla.cache.html

 
 			self['viewComponent']['clear_write_panel']();
 			self['viewComponent']['dialog']['show']();
+			self['viewComponent']['post_title']['setFocus'](true);
 			return null;
 		}
 	, 1, [null,null,['self'],['event']]);
 			} else {
 				var self = arguments[0];
 			}
-			var content,title;
+			var $add2,title,error_message,content,$add1;
+			error_message = '';
 			title = self['viewComponent']['post_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, title, $m.content]);
+				self['viewComponent']['post_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', title, $m.content]);
 			}
 			content = self['viewComponent']['post_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, title, content]);
-			}
-			return $p['tuple']([false, title, content]);
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add1='Post body must be less than 255 characters. It is ',$add2=$p['str']($p['len'](content))), title, content]);
+			}
+			return $p['tuple']([error_message, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_add'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var content,isEmpty,title;
+			var content,error_message,title;
 			var $tupleassign1 = self['validate_add']();
-			isEmpty = $tupleassign1.__getitem__(0);
+			error_message = $tupleassign1.__getitem__(0);
 			title = $tupleassign1.__getitem__(1);
 			content = $tupleassign1.__getitem__(2);
-			if ($p['bool']($p['op_eq'](isEmpty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			title = self['viewComponent']['post_title']['getText']();
 			self['viewComponent']['edit_title']['setText']((($attr61=($attr62=post)['title']) == null || (($attr62.__is_instance__) && typeof $attr61 == 'function') || (typeof $attr61['__get__'] == 'function')?
 						$p['getattr']($attr62, 'title'):
 						post['title']));
+			self['viewComponent']['edit_title']['setFocus'](true);
 			self['viewComponent']['edit_content']['setText']((($attr63=($attr64=post)['content']) == null || (($attr64.__is_instance__) && typeof $attr63 == 'function') || (typeof $attr63['__get__'] == 'function')?
 						$p['getattr']($attr64, 'content'):
 						post['content']));
 			} else {
 				var self = arguments[0];
 			}
-			var content,key,title;
+			var $add4,title,error_message,content,$add3,key;
+			error_message = '';
 			key = self['viewComponent']['edit_hidden_key']['getValue']();
 			if ($p['bool']($p['op_eq'](key, ''))) {
-				return $p['tuple']([true, key, $m.title, $m.content]);
+				return $p['tuple'](['Cannot update without a post identifier', key, $m.title, $m.content]);
 			}
 			title = self['viewComponent']['edit_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, key, title, $m.content]);
+				self['viewComponent']['edit_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', key, title, $m.content]);
 			}
 			content = self['viewComponent']['edit_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, key, title, content]);
-			}
-			return $p['tuple']([false, key, title, content]);
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', key, title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add3='Post body must be less than 255 characters. It is ',$add4=$p['str']($p['len'](content))), key, title, content]);
+			}
+			return $p['tuple']([error_message, key, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_edit'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var title,content,is_empty,key;
+			var title,error_message,content,key;
 			var $tupleassign2 = self['validate_edit']();
-			is_empty = $tupleassign2.__getitem__(0);
+			error_message = $tupleassign2.__getitem__(0);
 			key = $tupleassign2.__getitem__(1);
 			title = $tupleassign2.__getitem__(2);
 			content = $tupleassign2.__getitem__(3);
-			if ($p['bool']($p['op_eq'](is_empty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			self['edit_remote_proxy']['edit_remote_blog_post'](key, title, content);

File media/output/Blog.oldmoz.cache.html

 
 			self['viewComponent']['clear_write_panel']();
 			self['viewComponent']['dialog']['show']();
+			self['viewComponent']['post_title']['setFocus'](true);
 			return null;
 		}
 	, 1, [null,null,['self'],['event']]);
 			} else {
 				var self = arguments[0];
 			}
-			var content,title;
+			var $add2,title,error_message,content,$add1;
+			error_message = '';
 			title = self['viewComponent']['post_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, title, $m.content]);
+				self['viewComponent']['post_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', title, $m.content]);
 			}
 			content = self['viewComponent']['post_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, title, content]);
-			}
-			return $p['tuple']([false, title, content]);
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add1='Post body must be less than 255 characters. It is ',$add2=$p['str']($p['len'](content))), title, content]);
+			}
+			return $p['tuple']([error_message, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_add'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var content,isEmpty,title;
+			var content,error_message,title;
 			var $tupleassign1 = self['validate_add']();
-			isEmpty = $tupleassign1.__getitem__(0);
+			error_message = $tupleassign1.__getitem__(0);
 			title = $tupleassign1.__getitem__(1);
 			content = $tupleassign1.__getitem__(2);
-			if ($p['bool']($p['op_eq'](isEmpty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			title = self['viewComponent']['post_title']['getText']();
 			self['viewComponent']['edit_title']['setText']((($attr61=($attr62=post)['title']) == null || (($attr62.__is_instance__) && typeof $attr61 == 'function') || (typeof $attr61['__get__'] == 'function')?
 						$p['getattr']($attr62, 'title'):
 						post['title']));
+			self['viewComponent']['edit_title']['setFocus'](true);
 			self['viewComponent']['edit_content']['setText']((($attr63=($attr64=post)['content']) == null || (($attr64.__is_instance__) && typeof $attr63 == 'function') || (typeof $attr63['__get__'] == 'function')?
 						$p['getattr']($attr64, 'content'):
 						post['content']));
 			} else {
 				var self = arguments[0];
 			}
-			var content,key,title;
+			var $add4,title,error_message,content,$add3,key;
+			error_message = '';
 			key = self['viewComponent']['edit_hidden_key']['getValue']();
 			if ($p['bool']($p['op_eq'](key, ''))) {
-				return $p['tuple']([true, key, $m.title, $m.content]);
+				return $p['tuple'](['Cannot update without a post identifier', key, $m.title, $m.content]);
 			}
 			title = self['viewComponent']['edit_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, key, title, $m.content]);
+				self['viewComponent']['edit_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', key, title, $m.content]);
 			}
 			content = self['viewComponent']['edit_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, key, title, content]);
-			}
-			return $p['tuple']([false, key, title, content]);
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', key, title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add3='Post body must be less than 255 characters. It is ',$add4=$p['str']($p['len'](content))), key, title, content]);
+			}
+			return $p['tuple']([error_message, key, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_edit'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var title,content,is_empty,key;
+			var title,error_message,content,key;
 			var $tupleassign2 = self['validate_edit']();
-			is_empty = $tupleassign2.__getitem__(0);
+			error_message = $tupleassign2.__getitem__(0);
 			key = $tupleassign2.__getitem__(1);
 			title = $tupleassign2.__getitem__(2);
 			content = $tupleassign2.__getitem__(3);
-			if ($p['bool']($p['op_eq'](is_empty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			self['edit_remote_proxy']['edit_remote_blog_post'](key, title, content);

File media/output/Blog.opera.cache.html

 
 			self['viewComponent']['clear_write_panel']();
 			self['viewComponent']['dialog']['show']();
+			self['viewComponent']['post_title']['setFocus'](true);
 			return null;
 		}
 	, 1, [null,null,['self'],['event']]);
 			} else {
 				var self = arguments[0];
 			}
-			var content,title;
+			var $add2,title,error_message,content,$add1;
+			error_message = '';
 			title = self['viewComponent']['post_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, title, $m.content]);
+				self['viewComponent']['post_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', title, $m.content]);
 			}
 			content = self['viewComponent']['post_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, title, content]);
-			}
-			return $p['tuple']([false, title, content]);
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add1='Post body must be less than 255 characters. It is ',$add2=$p['str']($p['len'](content))), title, content]);
+			}
+			return $p['tuple']([error_message, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_add'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var content,isEmpty,title;
+			var content,error_message,title;
 			var $tupleassign1 = self['validate_add']();
-			isEmpty = $tupleassign1.__getitem__(0);
+			error_message = $tupleassign1.__getitem__(0);
 			title = $tupleassign1.__getitem__(1);
 			content = $tupleassign1.__getitem__(2);
-			if ($p['bool']($p['op_eq'](isEmpty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			title = self['viewComponent']['post_title']['getText']();
 			self['viewComponent']['edit_title']['setText']((($attr61=($attr62=post)['title']) == null || (($attr62.__is_instance__) && typeof $attr61 == 'function') || (typeof $attr61['__get__'] == 'function')?
 						$p['getattr']($attr62, 'title'):
 						post['title']));
+			self['viewComponent']['edit_title']['setFocus'](true);
 			self['viewComponent']['edit_content']['setText']((($attr63=($attr64=post)['content']) == null || (($attr64.__is_instance__) && typeof $attr63 == 'function') || (typeof $attr63['__get__'] == 'function')?
 						$p['getattr']($attr64, 'content'):
 						post['content']));
 			} else {
 				var self = arguments[0];
 			}
-			var content,key,title;
+			var $add4,title,error_message,content,$add3,key;
+			error_message = '';
 			key = self['viewComponent']['edit_hidden_key']['getValue']();
 			if ($p['bool']($p['op_eq'](key, ''))) {
-				return $p['tuple']([true, key, $m.title, $m.content]);
+				return $p['tuple'](['Cannot update without a post identifier', key, $m.title, $m.content]);
 			}
 			title = self['viewComponent']['edit_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, key, title, $m.content]);
+				self['viewComponent']['edit_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', key, title, $m.content]);
 			}
 			content = self['viewComponent']['edit_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, key, title, content]);
-			}
-			return $p['tuple']([false, key, title, content]);
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', key, title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add3='Post body must be less than 255 characters. It is ',$add4=$p['str']($p['len'](content))), key, title, content]);
+			}
+			return $p['tuple']([error_message, key, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_edit'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var title,content,is_empty,key;
+			var title,error_message,content,key;
 			var $tupleassign2 = self['validate_edit']();
-			is_empty = $tupleassign2.__getitem__(0);
+			error_message = $tupleassign2.__getitem__(0);
 			key = $tupleassign2.__getitem__(1);
 			title = $tupleassign2.__getitem__(2);
 			content = $tupleassign2.__getitem__(3);
-			if ($p['bool']($p['op_eq'](is_empty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			self['edit_remote_proxy']['edit_remote_blog_post'](key, title, content);

File media/output/Blog.safari.cache.html

 
 			self['viewComponent']['clear_write_panel']();
 			self['viewComponent']['dialog']['show']();
+			self['viewComponent']['post_title']['setFocus'](true);
 			return null;
 		}
 	, 1, [null,null,['self'],['event']]);
 			} else {
 				var self = arguments[0];
 			}
-			var content,title;
+			var $add2,title,error_message,content,$add1;
+			error_message = '';
 			title = self['viewComponent']['post_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, title, $m.content]);
+				self['viewComponent']['post_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', title, $m.content]);
 			}
 			content = self['viewComponent']['post_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, title, content]);
-			}
-			return $p['tuple']([false, title, content]);
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add1='Post body must be less than 255 characters. It is ',$add2=$p['str']($p['len'](content))), title, content]);
+			}
+			return $p['tuple']([error_message, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_add'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var content,isEmpty,title;
+			var content,error_message,title;
 			var $tupleassign1 = self['validate_add']();
-			isEmpty = $tupleassign1.__getitem__(0);
+			error_message = $tupleassign1.__getitem__(0);
 			title = $tupleassign1.__getitem__(1);
 			content = $tupleassign1.__getitem__(2);
-			if ($p['bool']($p['op_eq'](isEmpty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			title = self['viewComponent']['post_title']['getText']();
 			self['viewComponent']['edit_title']['setText']((($attr61=($attr62=post)['title']) == null || (($attr62.__is_instance__) && typeof $attr61 == 'function') || (typeof $attr61['__get__'] == 'function')?
 						$p['getattr']($attr62, 'title'):
 						post['title']));
+			self['viewComponent']['edit_title']['setFocus'](true);
 			self['viewComponent']['edit_content']['setText']((($attr63=($attr64=post)['content']) == null || (($attr64.__is_instance__) && typeof $attr63 == 'function') || (typeof $attr63['__get__'] == 'function')?
 						$p['getattr']($attr64, 'content'):
 						post['content']));
 			} else {
 				var self = arguments[0];
 			}
-			var content,key,title;
+			var $add4,title,error_message,content,$add3,key;
+			error_message = '';
 			key = self['viewComponent']['edit_hidden_key']['getValue']();
 			if ($p['bool']($p['op_eq'](key, ''))) {
-				return $p['tuple']([true, key, $m.title, $m.content]);
+				return $p['tuple'](['Cannot update without a post identifier', key, $m.title, $m.content]);
 			}
 			title = self['viewComponent']['edit_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, key, title, $m.content]);
+				self['viewComponent']['edit_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', key, title, $m.content]);
 			}
 			content = self['viewComponent']['edit_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, key, title, content]);
-			}
-			return $p['tuple']([false, key, title, content]);
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', key, title, content]);
+			}
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add3='Post body must be less than 255 characters. It is ',$add4=$p['str']($p['len'](content))), key, title, content]);
+			}
+			return $p['tuple']([error_message, key, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_edit'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var title,content,is_empty,key;
+			var title,error_message,content,key;
 			var $tupleassign2 = self['validate_edit']();
-			is_empty = $tupleassign2.__getitem__(0);
+			error_message = $tupleassign2.__getitem__(0);
 			key = $tupleassign2.__getitem__(1);
 			title = $tupleassign2.__getitem__(2);
 			content = $tupleassign2.__getitem__(3);
-			if ($p['bool']($p['op_eq'](is_empty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			self['edit_remote_proxy']['edit_remote_blog_post'](key, title, content);

File media/public/Blog.css

 
 .gwt-TextArea {
     width: 270px;
-    height: 250px;
+    height: 115px;
 }
 
 .gwt-TextBox {

File media/view.js

 
 			self['viewComponent']['clear_write_panel']();
 			self['viewComponent']['dialog']['show']();
+			self['viewComponent']['post_title']['setFocus'](true);
 			return null;
 		}
 	, 1, [null,null,['self'],['event']]);
 			} else {
 				var self = arguments[0];
 			}
-			var content,title;
+			var $add2,title,error_message,content,$add1;
+			error_message = '';
 			title = self['viewComponent']['post_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, title, $m.content]);
+				self['viewComponent']['post_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', title, $m.content]);
 			}
 			content = self['viewComponent']['post_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, title, content]);
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', title, content]);
 			}
-			return $p['tuple']([false, title, content]);
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['post_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add1='Post body must be less than 255 characters. It is ',$add2=$p['str']($p['len'](content))), title, content]);
+			}
+			return $p['tuple']([error_message, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_add'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var content,isEmpty,title;
+			var content,error_message,title;
 			var $tupleassign1 = self['validate_add']();
-			isEmpty = $tupleassign1.__getitem__(0);
+			error_message = $tupleassign1.__getitem__(0);
 			title = $tupleassign1.__getitem__(1);
 			content = $tupleassign1.__getitem__(2);
-			if ($p['bool']($p['op_eq'](isEmpty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			title = self['viewComponent']['post_title']['getText']();
 			self['viewComponent']['edit_title']['setText']((($attr61=($attr62=post)['title']) == null || (($attr62.__is_instance__) && typeof $attr61 == 'function') || (typeof $attr61['__get__'] == 'function')?
 						$p['getattr']($attr62, 'title'):
 						post['title']));
+			self['viewComponent']['edit_title']['setFocus'](true);
 			self['viewComponent']['edit_content']['setText']((($attr63=($attr64=post)['content']) == null || (($attr64.__is_instance__) && typeof $attr63 == 'function') || (typeof $attr63['__get__'] == 'function')?
 						$p['getattr']($attr64, 'content'):
 						post['content']));
 			} else {
 				var self = arguments[0];
 			}
-			var content,key,title;
+			var $add4,title,error_message,content,$add3,key;
+			error_message = '';
 			key = self['viewComponent']['edit_hidden_key']['getValue']();
 			if ($p['bool']($p['op_eq'](key, ''))) {
-				return $p['tuple']([true, key, $m.title, $m.content]);
+				return $p['tuple'](['Cannot update without a post identifier', key, $m.title, $m.content]);
 			}
 			title = self['viewComponent']['edit_title']['getText']();
 			if ($p['bool']($p['op_eq'](title, ''))) {
-				return $p['tuple']([true, key, title, $m.content]);
+				self['viewComponent']['edit_title']['setFocus'](true);
+				return $p['tuple'](['Title is a required field', key, title, $m.content]);
 			}
 			content = self['viewComponent']['edit_content']['getText']();
 			if ($p['bool']($p['op_eq'](content, ''))) {
-				return $p['tuple']([true, key, title, content]);
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple'](['Content is a required field', key, title, content]);
 			}
-			return $p['tuple']([false, key, title, content]);
+			if ($p['bool'](($p['cmp']($p['len'](content), 255) == 1))) {
+				self['viewComponent']['edit_content']['setFocus'](true);
+				return $p['tuple']([$p['__op_add']($add3='Post body must be less than 255 characters. It is ',$add4=$p['str']($p['len'](content))), key, title, content]);
+			}
+			return $p['tuple']([error_message, key, title, content]);
 		}
 	, 1, [null,null,['self']]);
 		$cls_definition['validate_edit'] = $method;
 				var self = arguments[0];
 				event = arguments[1];
 			}
-			var title,content,is_empty,key;
+			var title,error_message,content,key;
 			var $tupleassign2 = self['validate_edit']();
-			is_empty = $tupleassign2.__getitem__(0);
+			error_message = $tupleassign2.__getitem__(0);
 			key = $tupleassign2.__getitem__(1);
 			title = $tupleassign2.__getitem__(2);
 			content = $tupleassign2.__getitem__(3);
-			if ($p['bool']($p['op_eq'](is_empty, true))) {
-				self['viewComponent']['error_message_label']['setText']('All fields are required, Please complete all fields before saving.');
+			if ($p['bool'](($p['cmp']($p['len'](error_message), 0) == 1))) {
+				self['viewComponent']['error_message_label']['setText'](error_message);
 				return null;
 			}
 			self['edit_remote_proxy']['edit_remote_blog_post'](key, title, content);

File media/view.py

     def view_write_post(self, event):
         self.viewComponent.clear_write_panel()
         self.viewComponent.dialog.show()
+        self.viewComponent.post_title.setFocus(True)
 
     def on_close(self, event):
         self.viewComponent.dialog.hide()
 
     def validate_add(self):
+        error_message = ""
         title = self.viewComponent.post_title.getText()
         if title == "":
-            return (True, title, content)
+            self.viewComponent.post_title.setFocus(True)
+            return ("Title is a required field", title, content)
         content = self.viewComponent.post_content.getText()
         if content == "":
-            return (True, title, content)
-        return (False, title, content)
+            self.viewComponent.post_content.setFocus(True)
+            return ("Content is a required field", title, content)
+        if len(content) > 255:
+            self.viewComponent.post_content.setFocus(True)
+            return ("Post body must be less than 256 characters. It is " + str(len(content)), title, content)
+        return (error_message, title, content)
 
     def add_post(self, event):
-        isEmpty, title, content = self.validate_add()
-        if isEmpty == True:
+        error_message, title, content = self.validate_add()
+        if len(error_message) > 0:
             (self.viewComponent.
                 error_message_label.
-                setText("All fields are required, Please complete all fields before saving."))
+                setText(error_message))
             return
         title = self.viewComponent.post_title.getText()
         content = self.viewComponent.post_content.getText()
         post_id = post_key.replace("edit_", "")
         post = self.edit_remote_proxy.get_post(post_id)
         self.viewComponent.edit_title.setText(post.title)
+        self.viewComponent.edit_title.setFocus(True)
         self.viewComponent.edit_content.setText(post.content)
         self.viewComponent.edit_hidden_key.setValue(post_id)
 
     def validate_edit(self):
+        error_message = ""
         key = self.viewComponent.edit_hidden_key.getValue()
         if key == "":
-            return (True, key, title, content)
+            return ("Cannot update without a post identifier", key, title, content)
         title = self.viewComponent.edit_title.getText()
         if title == "":
-            return (True, key, title, content)
+            self.viewComponent.edit_title.setFocus(True)
+            return ("Title is a required field", key, title, content)
         content = self.viewComponent.edit_content.getText()
         if content == "":
-            return (True, key, title, content)
-        return (False, key, title, content)
+            self.viewComponent.edit_content.setFocus(True)
+            return ("Content is a required field", key, title, content)
+        if len(content) > 255:                                                                                                               
+            self.viewComponent.edit_content.setFocus(True)                                                                                   
+            return ("Post body must be less than 255 characters. It is " + str(len(content)), key, title, content)
+        return (error_message, key, title, content)
 
     def on_edit_close(self, event):
         self.viewComponent.edit_dialog.hide()
         self.sendNotification(Blog.AppFacade.EDIT_CANCELED)
 
     def edit_post(self, event):
-        is_empty, key, title, content = self.validate_edit()
-        if is_empty == True:
+        error_message, key, title, content = self.validate_edit()
+        if len(error_message) > 0:
             (self.
                 viewComponent.
                 error_message_label.
-                setText("All fields are required, Please complete all fields before saving."))
+                setText(error_message))
             return
         self.edit_remote_proxy.edit_remote_blog_post(key, title, content)
         self.on_edit_close()