Can't submit a form with Symfony2 and TinyMCE

2019-06-04 02:44发布

问题:

I have a form with a textarea enriched by the TinyMCE Javascript library. When the Javascript library is enabled, then if I press the submit button the page don't change! If I disable the library, everything works right! One may observe that the library is not used properly (I'm using the simplest example from the for dummies tutorial). However, I think that it is something related with the framework I'm using to develop the website: Symfony2.

Any idea?

回答1:

Sorry for the question, the answer has been found here in a post dedicated to the CKeditor and Symfony2.

In practice, the problem is due to the fact that the textarea was created inside the controller with a required=true value by default. Then, I only set the textarea widget to false and now it works!

In fact, the TinyMCE library (like the others) simply makes the default textarea as hidden and add its rich textarea to the html page. So, the browser still need some value for the textarea that cannot be passed when the textarea is hydden!