Can you nest html forms?

前端 未结 20 3598
悲&欢浪女
悲&欢浪女 2020-11-21 04:56

Is it possible to nest html forms like this

so

20条回答
  •  不要未来只要你来
    2020-11-21 05:20

    While I don't present a solution to nested forms (it doesn't work reliably), I do present a workaround that works for me:

    Usage scenario: A superform allowing to change N items at once. It has a "Submit All" button at the bottom. Each item wants to have its own nested form with a "Submit Item # N" button. But can't...

    In this case, one can actually use a single form, and then have the name of the buttons be submit_1..submit_N and submitAll and handle it servers-side, by only looking at params ending in _1 if the name of the button was submit_1.

    Ok, so not much of an invention, but it does the job.

提交回复
热议问题