I have an upload (uploadfile_form.asp) page with 4 elements - 2 select boxes, one input type = "file" and a submit (image) button.
First select box is populated from an Access DB .
On change of 1st select box (onChange="document.thisform.submit();">), I resubmit the form to populate the 2nd based on the value of 1st select box (requery same DB) .
3rd element is an input type="file", and I navigate to the file to be uploaded.
4th element is a submit (image) button, that will validate if 1st and 2nd select boxes are populated and then upload my selected file to the database.
Because of this enctype="multipart/form-data", my form does not get re-submitted to (onChange="document.thisform.submit();">) to populate the 2nd select box.
Any suggestions, recommendations and fixes will be greatly appreciated.
<SCRIPT language = "JavaScript">
<!--
function Run_OnClick()
{
var Opt1 = document.thisform.Opt1.value;
var Opt2 = document.thisform.Opt2.value
if (Opt1 == "" || Opt1 == "")
{
alert("Please make valid selection from dropdown.")
return false
}
else
{
url = "uploadfile1.asp?Opt1=" + Opt1 + "&Opt2=" + Opt2;
alert(url)
document.thisform.action = url;
document.thisform.submit();
//location.href=url
}
}
//-->
</SCRIPT>
<form name="thisform" action="uploadfile_form.asp" method="post" enctype="multipart/form-data">
<%
......
Option1: <SELECT name = "Opt1" onChange="document.thisform.submit();">
<OPTION>
<%
while not rs.eof
if rs("opt1") = opt1 then
%>
<OPTION value="<%=rs("opt1")%>" selected><%=rs("opt1")%>
<%
else
%>
<OPTION value="<%=rs("opt1")%>"><%=rs("opt1")%>
<%
end if
rs.movenext
wend
%>
</SELECT>
............
Option2: <SELECT name = "Opt2"'>
<OPTION>
<%
while not rs2.eof
%>
<OPTION value="<%=rs2("opt2")%>"><%=rs2("opt2")%>
<%
rs2.movenext
wend
%>
</SELECT>
............
<input name="file1" type="file" size="25"></td>
<input type=image src=<%=bupload%> id=upload name=upload onClick="Run_OnClick();return false">
First select box is populated from an Access DB .
On change of 1st select box (onChange="document.thisform.submit();">), I resubmit the form to populate the 2nd based on the value of 1st select box (requery same DB) .
3rd element is an input type="file", and I navigate to the file to be uploaded.
4th element is a submit (image) button, that will validate if 1st and 2nd select boxes are populated and then upload my selected file to the database.
Because of this enctype="multipart/form-data", my form does not get re-submitted to (onChange="document.thisform.submit();">) to populate the 2nd select box.
Any suggestions, recommendations and fixes will be greatly appreciated.
<SCRIPT language = "JavaScript">
<!--
function Run_OnClick()
{
var Opt1 = document.thisform.Opt1.value;
var Opt2 = document.thisform.Opt2.value
if (Opt1 == "" || Opt1 == "")
{
alert("Please make valid selection from dropdown.")
return false
}
else
{
url = "uploadfile1.asp?Opt1=" + Opt1 + "&Opt2=" + Opt2;
alert(url)
document.thisform.action = url;
document.thisform.submit();
//location.href=url
}
}
//-->
</SCRIPT>
<form name="thisform" action="uploadfile_form.asp" method="post" enctype="multipart/form-data">
<%
......
Option1: <SELECT name = "Opt1" onChange="document.thisform.submit();">
<OPTION>
<%
while not rs.eof
if rs("opt1") = opt1 then
%>
<OPTION value="<%=rs("opt1")%>" selected><%=rs("opt1")%>
<%
else
%>
<OPTION value="<%=rs("opt1")%>"><%=rs("opt1")%>
<%
end if
rs.movenext
wend
%>
</SELECT>
............
Option2: <SELECT name = "Opt2"'>
<OPTION>
<%
while not rs2.eof
%>
<OPTION value="<%=rs2("opt2")%>"><%=rs2("opt2")%>
<%
rs2.movenext
wend
%>
</SELECT>
............
<input name="file1" type="file" size="25"></td>
<input type=image src=<%=bupload%> id=upload name=upload onClick="Run_OnClick();return false">