ASP and Form Field Default Values

Results 1 to 4 of 4

Thread: ASP and Form Field Default Values

  1. #1
    Jeff Chastain Guest

    Default ASP and Form Field Default Values

    I am trying to setup a file upload form. The form fields look something like follows.<BR><BR>&#060;INPUT TYPE=FILE NAME="FILE1"&#062;<BR><BR>The File upload itself works fine, but what I would like to do is put a default value into the form field. I have been able to store a text string in a variable before and then use that default value in a text box, but the same does not appear to work with file inputs. Any ideas?<BR><BR>---------------------------------------<BR>This works ....<BR>---------------------------------------<BR>&#060;%<BR>Default = "Sample Text String"<BR>%&#062;<BR>&#060;FORM METHOD="POST" ACTION="UploadScript.asp"&#062;<BR> &#060;INPUT TYPE=TEXT NAME="FILE1" VALUE=&#060;%=Default%&#062;&#062;<BR> &#060;INPUT TYPE=SUBMIT&#062;<BR>&#060;/FORM&#062;<BR>---------------------------------------<BR>This doesn&#039t ..... why?<BR>---------------------------------------<BR>&#060;%<BR>Default = "Sample Text String"<BR>%&#062;<BR>&#060;FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="UploadScript.asp"&#062;<BR> &#060;INPUT TYPE=FILE NAME="FILE1" VALUE=&#060;%=Default%&#062;&#062;<BR> &#060;INPUT TYPE=SUBMIT&#062;<BR>&#060;/FORM&#062;

  2. #2 Guest

    Default RE: ASP and Form Field Default Values

    It is because of the encoding type - you cannot do a request.form on that type, you must use the components verison of it which differes obviously.<BR><BR>You should also put quotes around default values or spaces will not work. ie<BR>&#060;input type="text" name="name" value=joe soap&#062; <BR>would come back as joe..

  3. #3
    Jeff Chastain Guest

    Default RE: ASP and Form Field Default Values

    I follow the encoding type thing as to why I can&#039t use the response object, but I am not sure how that fits in here. I am just trying to substitute a default value, that the user can change if desired, into the form field. Reading the data sent by the form comes later in the form response file. <BR><BR>As far as putting quotes around the default text string, that is true. The code segment however is supposed to print the contents of the variable called default, which contains a text string in quotes, as the default value of the form field.<BR><BR>Any other ideas?

  4. #4
    Matt Thesing Guest

    Default RE: ASP and Form Field Default Values

    I am pretty sure that you are not allowed to have a default value for a FILE type. This is for security reasons. It prevents sites from pre-populating it will a filename of an important file (such as a password file) on the user&#039s machine which they (the user) could inadvertently submit.

Posting Permissions

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