I don't know if this is a asp.net or a javascript (or Ajax) problem but wonder if anyone can advise
Iv'e got a form for uploading files in which the user can enter a title and select a file (sometimes they want a more meaningful name than the filename)
<form ...>
<asp:textbox id="txtTitle" runat="server"></asp:textbox>
<input id="myFile" type="file" name="myFile" runat="server"/>
</form>
The myFile shows a browse button which allows you to go select a file (pretty straightforward so far)
What I'd like to do though is if the user uses the browse button to select a file and hasn't put in a title in the title field then the filename is put in the title field.
I tried using onChange on the myFile field
onchange="CheckTitleFilled()"
with
Private Sub CheckTitleFilled()
txtTitle.Text = myFile.Value
End Sub
but this doesn't seem to work (guess because its server side). Its easy to do this when you submit, but I'd like to do it dynamically when the user has selected a file, giving the user the choic of editing. Is there anyway of doing this - either in asp.net or javascript ?
AndyH1
Iv'e got a form for uploading files in which the user can enter a title and select a file (sometimes they want a more meaningful name than the filename)
<form ...>
<asp:textbox id="txtTitle" runat="server"></asp:textbox>
<input id="myFile" type="file" name="myFile" runat="server"/>
</form>
The myFile shows a browse button which allows you to go select a file (pretty straightforward so far)
What I'd like to do though is if the user uses the browse button to select a file and hasn't put in a title in the title field then the filename is put in the title field.
I tried using onChange on the myFile field
onchange="CheckTitleFilled()"
with
Private Sub CheckTitleFilled()
txtTitle.Text = myFile.Value
End Sub
but this doesn't seem to work (guess because its server side). Its easy to do this when you submit, but I'd like to do it dynamically when the user has selected a file, giving the user the choic of editing. Is there anyway of doing this - either in asp.net or javascript ?
AndyH1