Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#6449 closed defect (bug) (fixed)

Tiny MCE cuts html textarea form tag

Reported by: pozhonks's profile PozHonks Owned by:
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: TinyMCE Keywords: has-patch
Focuses: 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 (2)

bug-tiny-mce-and-form.png (62.3 KB) - added by PozHonks 17 years ago.
image of the bug
6449.patch (518 bytes) - added by azaozz 17 years ago.

Download all attachments as: .zip

Change History (14)

@PozHonks
17 years ago

image of the bug

#1 @azaozz
17 years ago

  • Milestone 2.5.1 deleted
  • Resolution set to invalid
  • Status changed from new to closed

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.

#2 follow-up: @Nazgul
17 years ago

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.

#3 @DD32
17 years ago

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..

#4 in reply to: ↑ 2 ; follow-up: @azaozz
17 years ago

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.

#5 in reply to: ↑ 4 ; follow-up: @Nazgul
17 years ago

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.

#6 in reply to: ↑ 5 @PozHonks
17 years ago

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.

#7 @azaozz
17 years ago

  • Keywords has-patch added; TinyMCE html form textarea removed
  • Milestone set to 2.6
  • Resolution invalid deleted
  • Status changed from closed to reopened

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.

@azaozz
17 years ago

#8 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

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

#9 @ryan
17 years ago

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

#10 @ryan
17 years ago

  • Milestone changed from 2.6 to 2.5.2

#11 @ryan
17 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#12 @westi
17 years ago

  • Milestone changed from 2.9 to 2.6
Note: See TracTickets for help on using tickets.