Professional Web Applications Themes

problem with reset/clear in <input type="file" > - Macromedia Dynamic HTML

how to clear values in input file object. In My Form i need to upload a file and enter some values in other text fields. i have "Submit" and "Clear". i f i click clear button i need to call a javascript function and clear all fields. I am able to clear all fields by setting "" to each field object. Where as for object <input type="file" > i could not clear value in it. my code is as below Can any one help me?? ------------ <script> fnClear(){ doent.forms[0].txtAttachment.value = ""; } </script> <html> <form> <input type="file" name="txtAttachment" size="50" maxlength="100" ...

  1. #1

    Default problem with reset/clear in <input type="file" >

    how to clear values in input file object.
    In My Form i need to upload a file and enter some values in other text fields.
    i have "Submit" and "Clear".
    i f i click clear button i need to call a javascript function and clear all
    fields.
    I am able to clear all fields by setting "" to each field object.

    Where as for object <input type="file" > i could not clear value in it.

    my code is as below
    Can any one help me??

    ------------
    <script>
    fnClear(){
    doent.forms[0].txtAttachment.value = "";
    }
    </script>
    <html>
    <form>
    <input type="file" name="txtAttachment" size="50" maxlength="100"
    id="txtAttachment" >

    123nani123 Guest

  2. #2

    Default Re: problem with reset/clear in <input type="file" >

    The answer is simples: the input[type='file'] don't have the "value"
    propertie. It's a security question... Realize that you enter a site
    and this site has a input[type='file'] in a hidden (position:
    absolute; top: -10000;). In the case of you could change the "value"
    property for a input[type='file'], you would be able to get files from
    the guest's PC without his permission. You would be able to change the
    "value" to any value and, if the path you set (i.e.:
    c:\windows\php.ini) exists in the guest's PC, the file would be sent
    to the server. Got it?
    You can do a simple "doent.forms['formname'].reset()" to solve
    your problem.

    []s

    --
    ~~ ~
    diego nunes
    web engineer
    ~ ~~


    Diego Nunes Guest

Similar Threads

  1. html <input type="file"> can you set a value first ?
    By J?J in forum Macromedia ColdFusion
    Replies: 2
    Last Post: March 27th, 03:42 PM
  2. Help please: Exception when with <input type="file"> but not with Textbox
    By Drew Berkemeyer in forum ASP.NET Web Services
    Replies: 1
    Last Post: November 16th, 10:22 AM
  3. <input type="image"... based custom control
    By Alfred Tascon in forum ASP.NET Building Controls
    Replies: 3
    Last Post: October 18th, 07:27 PM
  4. HTML + <input type="File">
    By Bhavin in forum ASP
    Replies: 2
    Last Post: October 22nd, 03:21 AM
  5. <input type="file"> readonly
    By Jarrod in forum ASP
    Replies: 1
    Last Post: October 2nd, 10:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139