Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset INPUT file= field #38

Open
VitoAsaro opened this issue Mar 14, 2014 · 2 comments
Open

reset INPUT file= field #38

VitoAsaro opened this issue Mar 14, 2014 · 2 comments

Comments

@VitoAsaro
Copy link

Jordan,
Thanks for the help on the previous topic. I was able to get the work-around with the Submit-button parameter.

I have a small problem however: This function allows the user to never leave the page, therefor the form from which it is called has an INPUT file= field, and this field is not cleared the next time the form appears. I've tried everthing via javascript and jquery to reset the value of the "input file" field to an empty string, or otherwise reset it, but I can't seem to reset/clear the field without breaking the ability to call the ajaxfileupload function again.

Thanks again!
-Vito

@jfeldstein
Copy link
Owner

Try remove()'ing it from the DOM, and creating (and re-initializing) an new
input.

Browsers have security checks so you can't fiddle with the value of File
type inputs.

~ Jordan

See what I'm into on AngelList https://angel.co/jordan-feldstein

On Thu, Mar 13, 2014 at 5:34 PM, VitoAsaro [email protected] wrote:

Jordan,
Thanks for the help on the previous topic. I was able to get the
work-around with the Submit-button parameter.

I have a small problem however: This function allows the user to never
leave the page, therefor the form from which it is called has an INPUT
file= field, and this field is not cleared the next time the form appears.
I've tried everthing via javascript and jquery to reset the value of the
"input file" field to an empty string, or otherwise reset it, but I can't
seem to reset/clear the field without breaking the ability to call the
ajaxfileupload function again.

Thanks again!
-Vito

Reply to this email directly or view it on GitHubhttps://github.com//issues/38
.

@unlocomqx
Copy link

Here's a solution to this issue

I think this shouldn't be handled by the plugin because the input is not always inside a form

Putting the reset code inside the complete callback would solve the issue

https://www.gyrocode.com/articles/how-to-reset-file-input-with-javascript/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants