【发布时间】:2018-12-20 22:56:59
【问题描述】:
我有多个按钮提交表单。我检查传入控制器的输入值单击了哪个按钮。
public async Task<ActionResult> MyAction(MyModel model, string command)
下面的 html 有效。在我的控制器中command 等于myValue
<input type="submit" name="command" value="myValue" />
下面的 html 不起作用。在我的控制器中command 是null
<input type="image" name="command" src="..." value="myValue"/>
W3C says the type 'image' is a submit button
那么为什么这两个输入元素的行为不同呢?
【问题讨论】:
-
Afaik
value不适用于图像提交按钮,至少在 FF 中是这样。可悲的是 W3C 与现实不一样
标签: asp.net-mvc html asp.net-mvc-5