Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 嵌套表单的解决方案_Html_Forms_Nested Forms - Fatal编程技术网

Html 嵌套表单的解决方案

Html 嵌套表单的解决方案,html,forms,nested-forms,Html,Forms,Nested Forms,有没有办法创建嵌套表单 像这样 <form action="" method="post"> <input type="text".... /> <input type="text".... /> <form action="some action"> <input type="submit" .... /> </form> </form> 如果没有,我如何在

有没有办法创建嵌套表单

像这样

<form action="" method="post">
    <input type="text".... />
    <input type="text".... />
    <form action="some action">
        <input type="submit" .... />
    </form>
</form>


如果没有,我如何在没有嵌套表单的情况下获得相同的函数呢?

不,您不能使用嵌套表单,但您的问题有一个简单的解决方案

<form action="" method="post">
    <input type="submit" name="action" value="action1" />
    <input type="submit" name="action" value="action2" />
</form>
ps:我看到您使用C#和.NET,这将被转换为:

public class ExampleController : Controller
{
    ....

    [HttpPost]
    public ActionResult Index(string action)
    {

        if (!string.IsNullOrEmpty(action) == "action1") {
            // Do something
        }

        if (!string.IsNullOrEmpty(action) == "action2") {
            // Do something
        }
    }

    ...
}

您希望通过嵌套表单实现什么?注意:对于HTML5,表单元素也可以位于
-元素之外,并使用。
public class ExampleController : Controller
{
    ....

    [HttpPost]
    public ActionResult Index(string action)
    {

        if (!string.IsNullOrEmpty(action) == "action1") {
            // Do something
        }

        if (!string.IsNullOrEmpty(action) == "action2") {
            // Do something
        }
    }

    ...
}