Reputation: 397
I have got simple form and would like to upload images once main submit button is pressed but not to upload images once Back button is pressed? Any ideas? Please see that BACK is executing different action on form.
<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>
Upvotes: 1
Views: 67
Reputation: 29694
If you disable the input it will not be submitted, see here for more details values of disabled inputs will not be submited?
so add:
document.getElementById('fileInputBox').disabled = true;
ie
<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';"/>
Upvotes: 1