您的位置:首页 > 编程语言 > Java开发

struts2 kindeditor teatarea拿不到值问题。

2015-07-27 08:30 609 查看
源:

<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 拿不到值