简体   繁体   English

为什么表单自动提交不起作用?

[英]Why form auto submit not working?

Why this accepted answer doesn't work for me? 为什么这个公认的答案对我不起作用?

Automatically submitting a form when an upload file is chosen 选择上传文件后自动提交表单

my code: 我的代码:

<form>
<input id="id_image" name="image" onchange="this.form.submit();" type="file">
<input id="send" type="submit" value="submit" name="submit">
</form>

Because you named your second input "submit" , which shadows the submit method of the form. 因为您将第二个输入命名为"submit" ,所以它掩盖了表单的submit方法。 Rename it. 重命名。

For example : 例如 :

<form>
<input id="id_image" name="image" onchange="this.form.submit();" type="file">
<input id="send" type="submit" value="submit" name="somename">
</form>

The solution is simple :D 解决方法很简单:D

<form>
<input id="id_image" name="image" onchange="this.form.submit();" type="file">
<input id="send" type="submit" value="submit" name="submit2">
</form>

The code it's ok, but you call the input button with submit..:D 代码还可以,但是您可以使用Submit ..:D调用输入按钮

Change the name and it's ok! 更改名称就可以了!

Hope this Help! 希望这个帮助! Bye. 再见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM