Solution: JSP cannot submit content in nicedit

Source: Internet
Author: User

Before testing the page function, we found that when you press the Enter key in the input field of input type = "text", the form will be automatically submitted, then, the submit button is changed from the submit type to the button type.

This solves the problem of automatic form submission, but leads to a new problem, that is, the nicedit Value in the form cannot be submitted.

See this article during Google's ProcessArticle(Nicedit cannot get textarea value under jquery) an inspiration is that you can read the content in the nicedit Rich Text Editor in JS and assign the content to textarea, then, submit the form.CodeIs:

 <  Textarea  Name  = "Intro"  Rows  = "15"  Cols  = "30"  ID  = "Introcontent" Style  = "Width: 750px; Height: 300px; Border: 1px solid #000 ;"  >
$ {Sightinfo. introduction}
</ Textarea > < Input Type = "Button" Value = "Submit" Onclick = "Certificate ('{introcontent'{.val({('.nicedit-main'{.html (); $ ('form'). Submit ();" />

 

('{Introcontent'{.val({('.nicedit-main'{.html ());

This Code ensures that the content in nicedit is assigned to the textarea element before the form is submitted. In this way, the value of "Intro" will not be blank when the servlet is read.

Related Article

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.