#41247 closed defect (bug) (invalid)
First form tag is removed from user table cell
Reported by: |
|
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.
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.
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
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/.