Submit ueditor In the form. Submit the ueditor form.
I have been searching for a better WEB text editor recently and found that ueditor is still good, but there are some problems after submitting data in forms, because he does not provide a virtual text box to submit data like the previous version, the online search results are not available. You can use editor as prompted by ueditor 1.4.3. the getContent () method obtains the content of the editor, but this method uses JS to obtain data. How can I normally POST data when submitting a form, you can only use some original methods. Add a hidden form item to the form, write the data in the editor using the getContent () method in the click submit button, and then submit the form.
As shown below:
Insert a hidden form item
<input name="info" type="hidden" id="info">
Change the submit button and add JS
<Input type = "button" name = "Submit" value = "Submit" onClick = "uptext ();">
<Script type = "text/javascript"> // This section should be placed after the text editor is instantiated. function uptext () {if (! UE. getEditor ('editor'). hasContents () {alert ('Please fill in the content first! ');} Else {document.setweb.info. value = UE. getEditor ('editor'). getContent (); document. setweb. submit () ;}</script>
After the above Code is inserted, the program can be called normally.
For example, ASP uses request ("info") PHP to get it with $ _ POST ["INFO"]. Currently, there is no problem in testing small text. I don't know how big text works, it is estimated that there will be a maximum length limit. It is unclear if you haven't tested it. Welcome to join us.
In the rich text editor, for example, Ueditor, how do I use the shortcut key to submit the edited content?
Doucment. onKeydown = function ()
{
// Determine whether the focus is in Ueditor and press ENTER.
If (document. activeElement. id = Ueditor. id & event. keyCode = 113)
{
Buttion. onclick ();
}
}
How to set the value of multiple ueditors on the page?
Var editor = new baidu. editor. ui. Editor ();
Editor. render ("myEditor ");
You can define multiple