blob: f1ef360e401a73b65efe81c1c669429e13cd9090 [file] [log] [blame]
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +00001<script>
2function clearWithReset()
3{
4 document.getElementById("form").reset();
5}
6function clearBySettingValue()
7{
8 document.getElementById("file").value = "";
9}
10function clearBySettingValueToNull()
11{
12 document.getElementById("file").value = null;
13}
14function clearBySettingValueToX()
15{
16 document.getElementById("file").value = "x";
17}
18</script>
19<p>Use this to test the various ways you can clear an input type=file element.</p>
20<form id="form">
21<p>Choose a file here: <input type="file" id="file"></input></p>
22<p>Then press one of these buttons, that should clear the file:
23<input type="button" value="clear with reset()" onclick="clearWithReset()">
24<input type="button" value="clear by setting value to ''" onclick="clearBySettingValue()"></p>
25<p>Or press this button that should clear the file, but won't, due to <a href="http://bugs.webkit.org/show_bug.cgi?id=13448">bug 13448</a>: <input type="button" value="clear by setting value to null" onclick="clearBySettingValueToNull()"></p>
26<p>Or press this button to verify we can't set to a non-empty value: <input type="button" value="clear by setting value to 'x'" onclick="clearBySettingValueToX()"></p>
27</form>