Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 141941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:51:26+00:00 2026-05-11T07:51:26+00:00

I know that XHTML doesn’t support nested form tags and I have already read

  • 0

I know that XHTML doesn’t support nested form tags and I have already read other answers here on Stack Overflow regarding this subject, but I still haven’t figured out an elegant solution to the problem.

Some say you don’t need it and that they can’t think of a scenario where this would be needed. Well, I can’t think of a scenario that I haven’t needed it.

Let’s see a very simple example:

You are making a blog app and you have a form with some fields for creating a new post and a toolbar with "actions" like "Save", "Delete", and "Cancel".

<form  action="/post/dispatch/too_bad_the_action_url_is_in_the_form_tag_even_though_conceptually_every_submit_button_inside_it_may_need_to_post_to_a_diffent_distinct_url" method="post">      <input type="text" name="foo" /> <!-- several of those here -->     <div id="toolbar">         <input type="submit" name="save" value="Save" />         <input type="submit" name="delete" value="Delete" />         <a href="/home/index">Cancel</a>     </div> </form> 

Our objective is to write the form in a way that doesn’t require JavaScript, just plain old HTML form and submit buttons.

Since the action URL is defined in the Form tag and not in each submit button, our only option is to post to a generic URL and then start "if…then…else" to determine the name of the button that was submitted. Not very elegant, but our only choice, since we don’t want to rely on JavaScript.

The only problem is that pressing "Delete", will submit ALL the form fields on the server even though the only thing needed for this action is a Hidden input with the post-id. Not a very big deal in this small example, but I have forms with hundreds (so to speak) of fields and tabs in my LOB applications that (because of requirements) have to submit everything in one go and in any case this seems very inefficient and a waste. If form nesting was supported, I would at least be able to wrap the "Delete" submit button inside its form with only the post-id field.

You may say "Just implement the "Delete" as a link instead of submit". This would be wrong on so many levels, but most importantly because Side-effect actions like "Delete" here, should never be a GET request.

So my question (particularly to those that say they haven’t needed form nesting) is What do YOU do? Is there any elegant solution that I’m missing or the bottom line is really "Either require JavaScript or submit everything"?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:51:27+00:00Added an answer on May 11, 2026 at 7:51 am

    I would implement this exactly as you described: submit everything to the server and do a simple if/else to check what button was clicked.

    And then I would implement a Javascript call tying into the form’s onsubmit event which would check before the form was submitted, and only submit the relevant data to the server (possibly through a second form on the page with the ID needed to process the thing as a hidden input, or refresh the page location with the data you need passed as a GET request, or do an Ajax post to the server, or…).

    This way the people without Javascript are able to use the form just fine, but the server load is offset because the people who do have Javascript are only submitting the single piece of data needed. Getting yourself focused on only supporting one or the other really limits your options unnecessarily.

    Alternatively, if you’re working behind a corporate firewall or something and everybody has Javascript disabled, you might want to do two forms and work some CSS magic to make it look like the delete button is part of the first form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 116k
  • Answers 117k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You probably shouldn't be doing this. If the cookie is… May 11, 2026 at 10:40 pm
  • Editorial Team
    Editorial Team added an answer You could add a check to allow control characters as… May 11, 2026 at 10:40 pm
  • Editorial Team
    Editorial Team added an answer GitHub uses SSH authentication so your tokens will be stored… May 11, 2026 at 10:40 pm

Related Questions

I know that XHTML doesn't support nested form tags and I have already read
Possible Duplicates: HTML 5 versus XHTML 1.0 Transitional? Why are (X)HTML 5 and XHTML
I have an img tag in my webapp that uses the onload handler to
Basically, I have to present a full-screen div on my page for various reasons.
I am looking for a regex statement that will let me extract the HTML

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.