如何在不使用 javascript 的情况下制作具有共享字段的多个表单?
<input type=text name=username />
<form action="/users">
... some fields ...
</form>
<form action="/admins">
... some another fields ...
</form>
最佳答案
没有必要在表单中输入标签:an input can be associated with its form using its form
attribute .
如果表单可以共享输入就好了,但我还没有听说过这个。也许我们应该要求 W3C 在 HTML6 中引入这个?
更新:一种解决方法是使用 <input type="submit" name="..." value="..." />
使一个表单具有多个“提交”按钮。或 <button type="submit" name="..." value="...">...</button>
元素,以便在按下任何按钮时提交所有字段,然后服务器端可以检查按下了哪个按钮。
关于html - 具有共享字段的多个表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2500516/