But if I put the validation back on and the script to set the file uploaded name to the file name box, I run into problems. I know what the problem is, but I don't know how to fix it.
One of the problems is with the javascript to set the name into the text box- it has UploadFile. as the name of the control and I have an UploadFile1 and an UploadFile2. How can I get it to loop thru both of the controls? Here is the javascript:
Code: Select all
<script type="text/javascript" language="javascript">
var lastName1="";var lastName2="";function setNames(){var a=document.getElementById("<%= UploadFile.ClientID %>").value;if(a.length>0){var b;var c=a.lastIndexOf("\\");if(c<0){c=a.lastIndexOf("/");if(c<0){b=a}else{b=a.substring(c+1)}}else{b=a.substring(c+1)}var f=document.getElementById("<%= UploadFileName.ClientID %>");if((f.value.length==0)||(f.value==lastName2)){b=b.replace(/ /g,"_");f.value=b;lastName2=b}}}
</script>