Problems getting text from an openWysiwyg enabled TextBox
I have a multiline text box on a form. I dropped in the js file for openWYSIWYG and attached it to the textbox. When I submit the form, the text box has no value. I'm having problems finding documentation on this library. Has anyone else used this who would be able to direct me as to where I can troubleshoot this issue.
The HTML is here:
<table>
<tr><td>Comment&开发者_运维知识库lt;/td>
<td><asp:TextBox ID="txtComment"
Height="150px"
TextMode="MultiLine"
runat="server" />
</td>
</tr>
<tr><td colspan="2"><asp:Button ID="btnSubmit"
runat="server"
OnClick="btnSumbit_Click"
Text="Submit" />
</table>
<script type="text/javascript" language="javascript">
WYSIWYG.attach('<%= txtComment.ClientID %>', full);
</script>
The codebehind for the method is:
public void btnSumbit_Click(object sender, EventArgs e)
{
//txtComment.Text is "" The text is not available
}
The area that you type in for the WYSIWYG editor isn't the actual textarea. When you attach the editor it hides the textarea and then displays an editable iframe. You can save the data from the iframe to the textarea one of two ways.
The openWYSIWYG editor has a button called 'save' (it's an icon of a floppy disk). You need to click that to save the entered text to the textbox that it attaches to. When you click it, it copies the text to the textarea and then submits the form.
Alternatively you can call the openWYSIWYG function to save the text to the textarea when the user clicks your submit button. If you call "WYSIWYG.updateTextArea('textarea name');" it will save the text into the textarea.
精彩评论