tinyMCE编辑内容不能提交
在tiny_mce_advanced.js加上函数
function updateValue(editId)
{
var textValue = document.getElementById(editId);
textValue.value = tinyMCE.getInstanceById(editId).getBody().innerHTML;
}
{
var textValue = document.getElementById(editId);
textValue.value = tinyMCE.getInstanceById(editId).getBody().innerHTML;
}
然后,提交form参照
<h:form id="Form1">
<fieldset>
<s:validateAll>
<div class="entry">
<a:cnCol tableName="testrichtext" fieldName="title"/>
<div class="input">
<h:inputText id="title" value="#{testrichtext.title}" />
<br/><span class="errors"><h:message for="title" /></span>
</div>
</div>
<div class="entry">
<a:cnCol tableName="testrichtext" fieldName="content"/>
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce_advanced.js"></script>
<h:inputTextarea id="mainText" name="content" value="#{testrichtext.content}" rows="10" cols="55"/>
</div>
<div class="entry errors"><h:messages globalOnly="true" /></div>
<div class="entry">
<div class="label"><f:verbatim> </f:verbatim></div>
<div class="input">
<h:commandLink onclick="updateValue('Form1:mainText');" action="#{testrichtextAction.confirmAdd}">
<a:cnMsg enMsg="ok"/>
</h:commandLink>
<h:commandLink action="#{testrichtextAction.cancel}">
<a:cnMsg enMsg="cancel"/>
</h:commandLink>
</div>
</div>
</s:validateAll>
</fieldset>
</h:form>
<fieldset>
<s:validateAll>
<div class="entry">
<a:cnCol tableName="testrichtext" fieldName="title"/>
<div class="input">
<h:inputText id="title" value="#{testrichtext.title}" />
<br/><span class="errors"><h:message for="title" /></span>
</div>
</div>
<div class="entry">
<a:cnCol tableName="testrichtext" fieldName="content"/>
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce_advanced.js"></script>
<h:inputTextarea id="mainText" name="content" value="#{testrichtext.content}" rows="10" cols="55"/>
</div>
<div class="entry errors"><h:messages globalOnly="true" /></div>
<div class="entry">
<div class="label"><f:verbatim> </f:verbatim></div>
<div class="input">
<h:commandLink onclick="updateValue('Form1:mainText');" action="#{testrichtextAction.confirmAdd}">
<a:cnMsg enMsg="ok"/>
</h:commandLink>
<h:commandLink action="#{testrichtextAction.cancel}">
<a:cnMsg enMsg="cancel"/>
</h:commandLink>
</div>
</div>
</s:validateAll>
</fieldset>
</h:form>