Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  3] [ 3]  / answers: 1 / hits: 80277  / 15 Years ago, mon, december 14, 2009, 12:00:00

There is a way to automatically submit a form without clicking to a submit button?



I have a form with one file input. I would submit the form after the user have selected one file.


More From » file

 Answers
15

yes, you can use the form.submit() function. Add an onchange listener on the file input and link it to the form.submit() function, like so:



<form action=upload.php method=post enctype=multipart/form-data>
<input type=file onchange=this.form.submit() name=myFile/>
</form>

[#98071] Thursday, December 10, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronniem

Total Points: 584
Total Questions: 111
Total Answers: 111

Location: Finland
Member since Sat, Nov 6, 2021
3 Years ago
ronniem questions
Sat, Apr 24, 21, 00:00, 3 Years ago
Wed, Mar 10, 21, 00:00, 3 Years ago
Sat, Feb 6, 21, 00:00, 3 Years ago
;