Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

clear input type="file" onsubmit with delay

Posted on 2010-11-28
5
Medium Priority
?
679 Views
Last Modified: 2012-05-10
I am making an attempt to write a script to clear an input file after I have clicked submit using a 1.5 second delay...I have many of these on a page so I am using an $i which needs to be passed to the function so it knows which input box to clear. Below  is the onclick method I am using and I am just not getting it to work..Any help would be greatly appreciated..Thanks

onclick="Func1Delay(<?php echo''.$i.''; ?>); "
<script type="text/javascript">
function formReset(id)
{
document.standard_use+id.["filename"+id]="";
}

function Func1Delay(id)
{
setTimeout("formReset("+id+")", 1500);
}

</script>

Open in new window

0
Comment
Question by:brad0525
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 6

Expert Comment

by:CyberGhost
ID: 34226394
you cannot change a value of a file element due to security reasons... however, you can REMOVE it from the page and APPEND a new one in the place of the old one, with the same ID, name and other attributes
0
 
LVL 14

Expert Comment

by:Dushyant Sharma
ID: 34229615
after clicking submit the fields will anyway be cleared. the page is going to navigate on another page.
0
 
LVL 16

Expert Comment

by:Justin Mathews
ID: 34231857
Can you post your HTML source?
0
 
LVL 6

Accepted Solution

by:
Codebot earned 2000 total points
ID: 34238779
use
document.getElementById(id).value="";
0
 
LVL 6

Expert Comment

by:CyberGhost
ID: 34401764
did that work?
I believe (and I have tested it, too) that "value" is a read-only property in browsers for the "file" field... am I wrong?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question