Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#41247 closed defect (bug) (invalid)

First form tag is removed from user table cell

Reported by: prudentbot's profile prudentbot Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: Users Keywords:
Focuses: administration Cc:

Description

I am trying to include forms in the Users table in the admin interface. However, it appears that the very first form of the first row is always escaped, and the inputs are then orphaned. The rest of the forms, however, are all perfectly fine.

http://i.imgur.com/elMOhL6.png

In this example, each User's buttons are in their own forms (there are four forms total). The very first "approve" button is the one that's lacking its form tags. The rest of them are all fine. This is consistent no matter what button is first. If, for example, I have "reject" before "approve", then it will be the reject button that is missing its form tags. If I only have one form per User, same result.

http://i.imgur.com/eJm6Nyx.png

I tested in both Chrome and Firefox. I also tried this without any other plugins active- same result.

Here's a gist with a condensed version of the plugin in question. https://gist.github.com/prudentbot/27d20e63f5b28c67cc0fc8845dc2c72e

Change History (3)

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Users
  • Focuses administration added

#2 @SergeyBiryukov
7 years ago

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

Hi @prudentbot, welcome to WordPress Trac! Thanks for the report.

The whole table is already inside a form. Nested forms is invalid HTML, so the browser ignores the first nested form and treats the </form> tag as a closing tag for the main form. The subsequent forms are then displayed as expected.

These posts might be helpful in finding a solution:
https://stackoverflow.com/questions/379610/can-you-nest-html-forms
https://stackoverflow.com/questions/597596/how-do-you-overcome-the-html-form-nesting-limitation

Since it's not a WordPress core issue, I'm going to close the ticket. If you need any help implementing a workaround, please try the support forums: https://wordpress.org/support/.

#3 @prudentbot
7 years ago

Awesome! Very sorry to bother you!

Note: See TracTickets for help on using tickets.