我有简单的表格,想要在按下主提交按钮后上传图像,但是一旦按下后退按钮就不上传图像?有任何想法吗?请注意BACK正在表单上执行不同的操作。
<form method="post" name="Form" id="Form" action="upload.php" enctype="multipart/form-data">
<input class="button_date" id="fileInputBox" style="margin-bottom: 5px;" type="file" name="file[]" extension="jpeg|jpg|png|gif|giff|tiff" required/>
<input class="button2 cancel" style="border-right:none; font-size:13px;" name="Back" id="Back" type="submit" value="Back" onClick="javascript: form.action='back.php';"/>
<input class="button2" style="border-right:none; font-size:13px;" name="List Item" id="submit" type="submit" value="List Item" onClick="removeFocus()"/>
</form>
答案 0 :(得分:1)
如果您停用了输入,则无法提交,请参阅此处了解详情values of disabled inputs will not be submited?
所以添加:
document.getElementById('fileInputBox').disabled = true;
即
<input class="button2 cancel" style="border-right:none; font-size:13px;" name="Back"
id="Back" type="submit" value="Back"
onClick="javascript:document.getElementById('fileInputBox').disabled = true;
form.action='back.php';"/>