struts2 kindeditor teatarea拿不到值问题。

源:

<script type="text/javascript">
			var editor;
			KindEditor.ready(function(K) {
				editor = K.create('textarea[name="userinfo.introduce"]', {
					resizeType : 1,
					allowPreviewEmoticons : false,
					allowImageUpload : false,
					afterCreate : function() {
								var self = this;
								self.sync();
								K.ctrl(document, 13, function() {
									document.forms['addform'].submit();
								});
								K.ctrl(self.edit.doc, 13, function() {
									document.forms['addform'].submit();
								});
							},       
					items : [
						'fullscreen','source','preview','|','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
					
				});
			});
</script>

HTML代码

<textarea name="userinfo.introduce" style="width:700px;height:200px;visibility:hidden;"></textarea>

这样子在后台的strts2的action中拿到的是空。

只有再加上这段语句才可以获得。

afterBlur:function(){ 
                          this.sync(); 
                    }

加上后:

<script type="text/javascript">
			var editor;
			KindEditor.ready(function(K) {
				editor = K.create('textarea[name="userinfo.introduce"]', {
					resizeType : 1,
					allowPreviewEmoticons : false,
					allowImageUpload : false,
					afterCreate : function() {
								var self = this;
								self.sync();
								K.ctrl(document, 13, function() {
									document.forms['addform'].submit();
								});
								K.ctrl(self.edit.doc, 13, function() {
									document.forms['addform'].submit();
								});
							},
					afterBlur:function(){ 
                          this.sync(); 
                    },       
					items : [
						'fullscreen','source','preview','|','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
					
				});
			});
</script>

 

 

你可能感兴趣的:(拿不到值,teatarea)