首页 > 解决方案 > 在某些输入未填写时从表单发送数据

问题描述

<form action="/test" method="post>
<input type="text" name="something">
<input type="text" name="something_again">
<button type="submit"></button>
</form>

当我填写两个输入时,数据会在 req.body 中发送,我可以随意使用它们,但如果我只填写一个输入或不填写任何输入,则什么都不会发生并且 req.body 为空。当没有填写所有输入时,我该怎么做才能在 req.body 中有数据?

标签: node.jsformsexpress

解决方案


推荐阅读