Ticket #6449 (closed defect: fixed)

Opened 5 months ago

Last modified 3 weeks ago

Tiny MCE cuts html textarea form tag

Reported by: PozHonks Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: TinyMCE Version: 2.5
Severity: normal Keywords: has-patch
Cc:

Description

When you edit a page that contains a html form (eg. a contact form), Tiny MCE cuts the content after the first </textarea> tag. It always appears when you edit a page (not tested with a post) and you use Tiny MCE by default as the first editor. If the HTML is the first editor displayed, there is no such bug.

The rest of the content is displayed just below the edit area, but lays outside the edit area. See the picture here: <http://demo21.ovh.com/5bfed4cf73c151b9fc0f6b5e71f4bc87P/?see=bug-tiny-mce-and-form.png>

You see, above the "send it" button? Then, everything below this separation is lost, it is not in the edit area anymore (no "send it" button, no privacy statements, etc.), even if I switch to the HTML area. This cutting always happens after the first </textarea> tag when Tiny MCE is activated first.

Attachments

bug-tiny-mce-and-form.png (62.3 kB) - added by PozHonks on 03/29/08 18:27:03.
image of the bug
6449.patch (0.5 kB) - added by azaozz on 06/12/08 10:17:32.

Change History

03/29/08 18:27:03 changed by PozHonks

  • attachment bug-tiny-mce-and-form.png added.

image of the bug

03/30/08 01:15:31 changed by azaozz

  • status changed from new to closed.
  • resolution set to invalid.
  • milestone deleted.

Both WordPress and TinyMCE don't support adding forms in the content for a simple reason: forms need a back-end to process the submitted input.

If you want to add a form, you will need a plugin to process the data. Plugins have many different ways of displaying or changing content on every post, page, in the sidebar, etc.

(follow-up: ↓ 4 ) 03/30/08 09:02:32 changed by Nazgul

Since when doesn't WordPress support adding forms to the content?

I've had forms in my blog posts and pages, without needing a plugin. And the wpautop function for instance has had code to handle form related tags for ages.

It could be that TinyMCE doesn't support forms (I don't use the RTE), but WordPress does.

03/30/08 09:19:01 changed by DD32

TinyMCE chokes on </textarea as it thinks thats the end of the <Textarea> which the content editing window is..

You can put Forms into a blog post, but its not a general use, and as said, having a </textarea> in a post will cause TinyMCE to die badly..

(in reply to: ↑ 2 ; follow-up: ↓ 5 ) 03/30/08 09:51:40 changed by azaozz

Replying to Nazgul:

Since when doesn't WordPress support adding forms to the content? I've had forms in my blog posts and pages, without needing a plugin. And the wpautop function for instance has had code to handle form related tags for ages. It could be that TinyMCE doesn't support forms (I don't use the RTE), but WordPress does.

Agree, but what happens with the input from these forms?

TinyMCE can handle the html part for forms with a plugin, it can also handle tables, inline css, image uploading and resizing, file manager, search and replace, has a context menu, etc. but is not setup this way in WordPress. It would make it too complicated for the average user.

The fact is that a plugin is needed to handle the form data in WordPress and generally it's better to create forms with the plugin instead of having them hard-coded into the content, as if/when the backend plugin is removed, there will be non-working forms in the posts that probably will lead to 404s when submitted, etc.

(in reply to: ↑ 4 ; follow-up: ↓ 6 ) 03/30/08 10:07:05 changed by Nazgul

Replying to azaozz:

Agree, but what happens with the input from these forms? TinyMCE can handle the html part for forms with a plugin, it can also handle tables, inline css, image uploading and resizing, file manager, search and replace, has a context menu, etc. but is not setup this way in WordPress. It would make it too complicated for the average user.

I agree with you in closing this ticket (which is also the reason I didn't reopen the ticket), but I just wanted to point out that it's possible to use forms in post/pages if you don't use the RTE.

It's not something "average Joe" will do, but it is functionallity offered by WordPress, so stating that WordPress doesn't support forms in posts/pages is wrong.

(in reply to: ↑ 5 ) 03/30/08 20:40:51 changed by PozHonks

Thank you gentlemen for your understanding. I still claim it is a bug: For editing a page, when the HTML editor is first displayed, and then I click on Visual editor (TinyMCE), the form is perfect, no bug, everything is fine, TinyMCE handles it. When the Visual editor shows first, the forms is cut. So, for one case it is working, and in another quite similar situation it is not working; I call this a bug, not an unsupported feature. So, if you think I am wrong, there is nothing I can do.

06/12/08 10:17:00 changed by azaozz

  • keywords changed from TinyMCE html form textarea to has-patch.
  • status changed from closed to reopened.
  • resolution deleted.
  • milestone set to 2.6.

Traced this to wp_richedit_pre() not encoding < and > to html entities. So when TinyMCE loads the content of the textarea, it stops at the first </textarea> tag.

However wp_htmledit_pre() encodes < and >, that's the reason it works properly when the HTML editor is loaded first.

06/12/08 10:17:32 changed by azaozz

  • attachment 6449.patch added.

06/12/08 21:38:34 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [8073]) Encode < and > in wp_richedit_pre. Props azaozz. fixes #6449

06/12/08 21:38:58 changed by ryan

(In [8074]) Encode < and > in wp_richedit_pre. Props azaozz. fixes #6449 for 2.5

06/12/08 21:39:20 changed by ryan

  • milestone changed from 2.6 to 2.5.2.

07/15/08 16:24:07 changed by ryan

  • milestone changed from 2.5.2 to 2.9.

Milestone 2.5.2 deleted

07/30/08 20:31:39 changed by westi

  • milestone changed from 2.9 to 2.6.