vani_ge
12-13-2005, 06:29 PM
Hi,
I have a dropdownbox in my page and the selected value of it is to be sent to a java function .so that i can send that variable to the same page.
Later using request.querystring() method i had that variable used in a sql query to populate a textbox with the result set.The problem is ....
i have a alert stmt in the java script function and only after clicking that alert box i am having the result i the textbox.If that alert is removed inothing is happening.
another issue is....after i click that alert box and after the data is being displayed in the textbox the page is loading itself again and all the data is lost
below is the code for that.........Please help me in this............
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<style type="text/css" media="all">@import "../inc/uopstu.css";</style>
<SCRIPT language="JavaScript" type="text/javascript">
<!--
var checkflag = "false";
sub showform
<script>
<% if Request.querystring("Action")="" then %>
function OOchange(form)
{
if(document.f1.Campus.options[document.f1.Campus.selectedIndex].value)
{
var Campus="";
Campus=document.f1.Campus.options[document.f1.Campus.selectedIndex].value;
alert(Campus);
(document.f1.action= 'svr_temp.asp?Action=1 & campus=' + Campus);
document.f1.method = "POST";
document.f1.submit();
flag="true";
hidden_Team_Auto.style.display='block';
}
}
<% else %>
alert("<%= Request.QueryString("campus")%>);
</script>
<tr id="hidden_Division" style="display:none;">
<TD align=right width=50% height="22">Select a Campus Name</I></TD>
<TD align=left height="48">
<SELECT Name="Campus" Size="1" onChange="OOchange(this.form)" ID="Select2">
<% Do While NOT MyRS1.EOF %>
<option Value="<%= MyRS1("CampusName") %>"><%= MyRs1("CampusName")%></option>
<% MyRS1.MoveNext
loop %>
</SELECT>
</TD>
</tr>
<!--#include File="../inc/LSDevConn.asp"-->
<%
'if request.querystring("Campus") <> "" then
if campus<> "" then
'response.Write("hi")
'response.End
'MYSQL2="Select distinct substring(collector_name,13,5) AS Code from svr_compare where substring(collector_name,1,4)= (select Collector_Code from CampCollCode where Division='"& request.QueryString("campus")& "')"
MYSQL2="Select distinct substring(collector_name,13,5) AS Code from svr_compare where substring(collector_name,1,4)= (select Collector_Code from CampCollCode where Division='"& campus & "')"
Set MyRs2=MyConn.Execute(MySQL2)
Dim str
str=MyRS2("Code")
MyRS2.MoveNext
Do While NOT MyRS2.EOF
str=str & "," & MyRS2("Code")
MyRS2.MoveNext
loop
end if
%>
<TR id="hidden_Team_Auto" style="display:none;">
<TD align=left height="48">
<INPUT type=text name=TeamNumAuto maxlength=25 size=15 value= "<% =str %>" ID="Text1">
</TD>
</TR>
</table>
</form>
</html>
end sub
I have a dropdownbox in my page and the selected value of it is to be sent to a java function .so that i can send that variable to the same page.
Later using request.querystring() method i had that variable used in a sql query to populate a textbox with the result set.The problem is ....
i have a alert stmt in the java script function and only after clicking that alert box i am having the result i the textbox.If that alert is removed inothing is happening.
another issue is....after i click that alert box and after the data is being displayed in the textbox the page is loading itself again and all the data is lost
below is the code for that.........Please help me in this............
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<style type="text/css" media="all">@import "../inc/uopstu.css";</style>
<SCRIPT language="JavaScript" type="text/javascript">
<!--
var checkflag = "false";
sub showform
<script>
<% if Request.querystring("Action")="" then %>
function OOchange(form)
{
if(document.f1.Campus.options[document.f1.Campus.selectedIndex].value)
{
var Campus="";
Campus=document.f1.Campus.options[document.f1.Campus.selectedIndex].value;
alert(Campus);
(document.f1.action= 'svr_temp.asp?Action=1 & campus=' + Campus);
document.f1.method = "POST";
document.f1.submit();
flag="true";
hidden_Team_Auto.style.display='block';
}
}
<% else %>
alert("<%= Request.QueryString("campus")%>);
</script>
<tr id="hidden_Division" style="display:none;">
<TD align=right width=50% height="22">Select a Campus Name</I></TD>
<TD align=left height="48">
<SELECT Name="Campus" Size="1" onChange="OOchange(this.form)" ID="Select2">
<% Do While NOT MyRS1.EOF %>
<option Value="<%= MyRS1("CampusName") %>"><%= MyRs1("CampusName")%></option>
<% MyRS1.MoveNext
loop %>
</SELECT>
</TD>
</tr>
<!--#include File="../inc/LSDevConn.asp"-->
<%
'if request.querystring("Campus") <> "" then
if campus<> "" then
'response.Write("hi")
'response.End
'MYSQL2="Select distinct substring(collector_name,13,5) AS Code from svr_compare where substring(collector_name,1,4)= (select Collector_Code from CampCollCode where Division='"& request.QueryString("campus")& "')"
MYSQL2="Select distinct substring(collector_name,13,5) AS Code from svr_compare where substring(collector_name,1,4)= (select Collector_Code from CampCollCode where Division='"& campus & "')"
Set MyRs2=MyConn.Execute(MySQL2)
Dim str
str=MyRS2("Code")
MyRS2.MoveNext
Do While NOT MyRS2.EOF
str=str & "," & MyRS2("Code")
MyRS2.MoveNext
loop
end if
%>
<TR id="hidden_Team_Auto" style="display:none;">
<TD align=left height="48">
<INPUT type=text name=TeamNumAuto maxlength=25 size=15 value= "<% =str %>" ID="Text1">
</TD>
</TR>
</table>
</form>
</html>
end sub