Submit ueditor In the form. Submit the ueditor form.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.