Can you change the contents of a form with JavaScript or are the contents
protected?
I am developing a file upload page (the upload part I can manage) where
the user selects a file, and the and instead of a proper SUBMIT button I
have and ordinary button with onClick to a javascript function as below.
All I'm trying to do is to append ".rcf" onto the end of the filename.,
and then submit the form with this filename. The code looks as if it
ought to work, but doesn't.
(Further javascript will actually create the .rcf file, leave that to me!)
<SCRIPT LANGUAGE="javascript">
function ImgUploadForm_onClick()
{
document.ImgUploadForm.ImgFileName.value = document.ImgUploadForm.ImgFileName.value + ".rcf" ;
document.ImgUploadForm.submit();
}
</SCRIPT>
For completeness, here's the form code:
<FORM NAME="ImgUploadForm" ACTION="formresp.asp" ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST">
<INPUT TYPE="FILE" NAME="ImgFileName"><BR>
<INPUT TYPE="BUTTON" NAME="SUB1" VALUE="Upload File" onClick="ImgUploadForm_onClick()">
</FORM>
Any thoughts welcome.