Passing a variable (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


SirAldemar -> Passing a variable (4/1/2005 14:10:15)

This may be simple to some of you but how can I pass a varialbe to a DRW page so that a database lookup can be done based on the variable being passed?

Example:

One page one a user will select from a drop down menu. Based on this selection I pass (via the web page line the IP field value (IP address) of the record to another page.

On this page I want to look up a record based on the field that was passed (IP Address) via a DRW.

So, how can I insert into the DRW a variable being passed from a different page?

<html>
<head>
	<title></title>
</head>

<body bgcolor="white" text="black" link="blue" vlink="blue" alink="blue">

<FORM NAME="GetDev">
	<INPUT TYPE="hidden" NAME="DevInfo">
</FORM>

<SCRIPT LANGUAGE="javascript">
	var locate = window.location
	document.GetDev.DevInfo.value = locate

	var text = document.GetDev.DevInfo.value

	function IP1(str)
		{
			theleft = str.lastIndexOf("IP=") + 3;
			theright = str.lastIndexOf("IP=") + 6;
			return(str.substring(theleft, theright))
		}
	function IP2(str)
		{
			theleft = str.indexOf("IP=") + 3;
			return(str.substring(theleft, str.length))
		}
</SCRIPT>

<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address =  <script language="javascript>IP2(text)</script>) ORDER BY IP_Address ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="DataNetworks"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="IP_Address"
fp_sMenuValue="IP_Address"
fp_sColTypes="&Type=202&Management=202&Shelf_Location=202&Remote=202&Shelf#=4&Circuit_ID=202&Pinged?=11&IP_Address=202&Shelf_Type=202&Term_CO=202&Term_CO_2=202&Term_Dev=202&Term_Shelf#=4&Transport=202&Intermapper_Location=202&Intmap=202&Alm=202&Model=202&Ver=202&Fan Iss=11&"
fp_iDisplayCols=20
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="20401" -->
				document.write("<font color=\"#0000FF\">City: </font><b><u>"+<%=FP_FieldHTML(fp_rs,"Shelf_Location")%>+"</u></b>"); 
				document.write("<font color=\"#0000FF\">Device Type: </font><b><u>"+<%=FP_FieldHTML(fp_rs,"Type")%>+"</u></b>");
				document.write("<font color=\"#0000FF\">IP:</font> <b><u><a>"+<%=FP_FieldHTML(fp_rs,"IP_Address")%>+"</a></u></b>"); 
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan -->





dzirkelb1 -> RE: Passing a variable (4/1/2005 14:19:58)

Is the variable coming from a hyperlink or from a form?

If from a form, and the form is posting to your page with teh sql, its simply SELECT * FROM table WHERE (fieldname='::selecteditem::')

If it is from a hyperlink, its SELECT * FROM table WHERE (fieldname=&request.querystring("whatever")&)

is that what your looking for?




SirAldemar -> RE: Passing a variable (4/1/2005 15:21:59)

Yes, this does help.

But how can I use the variables that the DRW from the second page produces outside of the database section? I want to be able to display certain fields in specific locations on my screen.

If I use <%=FP_FieldHTML(fp_rs,"Shelf_Location")%> it keeps telling me I need another file...




dzirkelb1 -> RE: Passing a variable (4/1/2005 15:34:50)

You will more than likely need to create a variable within the database section...

--include file 1
<%
variable=fp_field(fprs,"field1")
%>
--include file 2

then, you can call that variable anywhere on your page (as long as it is below the code it was created) like so:

The color of this screen is <%=variable%>. That will print whatever the value of variable is wherever you wish to have it printed.




SirAldemar -> RE: Passing a variable (4/1/2005 15:52:22)

quote:

You will more than likely need to create a variable within the database section...

--include file 1
<%
variable=fp_field(fprs,"field1")
%>
--include file 2


Thank you for the suggestions but this is not working. When I add...

<%Variable=fp_field(fprs,"field1")

and save the file, FP removes this information.

I next tried it by removing...

<!--webbot bot="DatabaseRegionStart" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-columntypes="202,202,202,202,4,202,11,202,202,202,202,202,4,202,202,202,202,202,202,11" s-dataconnection="DataNetworks" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="DSLAMS" s-displaycolumns="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-criteria="[IP_Address] EQ (IP2(text)) +" s-order="[IP_Address] +" s-sql="SELECT * FROM DSLAMS WHERE (IP_Address = (IP2(text))) ORDER BY IP_Address ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" startspan -->

When I saved the document it did not disappear but neither did it show up on the page when viewed.

Can you possible tell me what I am doing wrong?




rdouglass -> RE: Passing a variable (4/1/2005 16:02:41)

quote:

and save the file, FP removes this information.


To prevent this from happening, you need to put the page on a Spooky Diet:

http://www.outfront.net/spooky/adv_drw_diet.htm

Just be sure to back it up first. [;)]




SirAldemar -> RE: Passing a variable (4/1/2005 16:06:16)

Follow-up to my last comment:

I got the variable to stay in the DRW area now. But the Select statement seems no to be working. I did not notice this at first.


I use this code to get the information from the hyperlink and it is working just fine.
<FORM NAME="GetDev">
	<INPUT TYPE="hidden" NAME="DevInfo">
</FORM>

<SCRIPT LANGUAGE="javascript">
	var locate = window.location
	document.GetDev.DevInfo.value = locate

	var text = document.GetDev.DevInfo.value

	function IP1(str)
		{
			theleft = str.lastIndexOf("IP=") + 3;
			theright = str.lastIndexOf("IP=") + 6;
			return(str.substring(theleft, theright))
		}
	function IP2(str)
		{
			theleft = str.indexOf("IP=") + 3;
			return(str.substring(theleft, str.length))
		}
</SCRIPT>


This is what I changed in the DRW to account for the code from above.

fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address =  (IP2(text))) ORDER BY IP_Address ASC"


Any more thoughts on this?




dzirkelb1 -> RE: Passing a variable (4/1/2005 16:13:29)

The drw changed your sql (it does that when goign to the diet)...change it to:

fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address = (IP2(text)) ORDER BY IP_Address ASC"

it seemed to add a )

see if that works, if it doesn't, type:

<%=fp_sQry%>
before your include file 1 and copy / paste what is printed to the screen







dzirkelb1 -> RE: Passing a variable (4/1/2005 16:14:11)

also, post the whole drw region if you could from include file to include file 2




SirAldemar -> RE: Passing a variable (4/1/2005 16:22:58)

		<!--webbot bot="DatabaseRegionStart" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-columntypes="202,202,202,202,4,202,11,202,202,202,202,202,4,202,202,202,202,202,202,11" s-dataconnection="DataNetworks" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="DSLAMS" s-displaycolumns="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-criteria="[IP_Address] EQ (IP2(text)) +" s-order="[IP_Address] +" s-sql="SELECT * FROM DSLAMS WHERE (IP_Address =  (IP2(text))) ORDER BY IP_Address ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" startspan --><!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address =  (IP2(text))) ORDER BY IP_Address ASC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=20 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="DataNetworks"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&Type=202&Management=202&Shelf_Location=202&Remote=202&Shelf_Num=4&Circuit_ID=202&Pinged?=11&IP_Address=202&Shelf_Type=202&Term_CO=202&Term_CO_2=202&Term_Dev=202&Term_Shelf#=4&Transport=202&Intermapper_Location=202&Intmap=202&Alm=202&Model=202&Ver=202&Fan Iss=11&"
fp_iDisplayCols=20
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="19061" --><tr>
<%
Type1=FP_FieldVal(fp_rs,"Type")
%>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Type" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Type<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Type")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="7359" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Management" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Management<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Management")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="29633" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Shelf_Location" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Shelf_Location<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Shelf_Location")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="40580" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Remote" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Remote<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Remote")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="15080" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Shelf_Num" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Shelf_Num<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Shelf_Num")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="19933" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Circuit_ID" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Circuit_ID<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Circuit_ID")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="21521" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Pinged?" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Pinged?<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Pinged?")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="12739" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="IP_Address" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>IP_Address<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"IP_Address")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="27374" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Shelf_Type" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Shelf_Type<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Shelf_Type")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="29322" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Term_CO" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Term_CO<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Term_CO")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="12467" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Term_CO_2" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Term_CO_2<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Term_CO_2")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="14912" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Term_Dev" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Term_Dev<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Term_Dev")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="15678" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Term_Shelf#" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Term_Shelf#<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Term_Shelf#")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="29240" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Transport" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Transport<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Transport")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="22345" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Intermapper_Location" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Intermapper_Location<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Intermapper_Location")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="59190" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Intmap" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Intmap<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Intmap")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="15671" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Alm" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Alm<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Alm")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="2754" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Model" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Model<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Model")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="9091" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Ver" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Ver<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Ver")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="3207" --></td>
			<td>
			<!--webbot bot="DatabaseResultColumn" s-columnnames="Type,Management,Shelf_Location,Remote,Shelf_Num,Circuit_ID,Pinged?,IP_Address,Shelf_Type,Term_CO,Term_CO_2,Term_Dev,Term_Shelf#,Transport,Intermapper_Location,Intmap,Alm,Model,Ver,Fan Iss" s-column="Fan Iss" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Fan Iss<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"Fan Iss")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="11773" --></td>
		</tr>
		<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the end of a Database Results region.</font></td></tr>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody>
</table>





dzirkelb1 -> RE: Passing a variable (4/1/2005 16:27:32)

Change the sql code above (remove the parenthees) and add <%=fp_sQry%> right after the include file1 and see what it displays please.




SirAldemar -> RE: Passing a variable (4/1/2005 16:38:57)

No worky....


Here are the changes I made (if I understood your notes correctly)...

(Note: This code has been put on a diet.... LOL)
<body bgcolor="white" text="black" link="blue" vlink="blue" alink="blue">

<FORM NAME="GetDev">
	<INPUT TYPE="hidden" NAME="DevInfo">
</FORM>

<SCRIPT LANGUAGE="javascript">
	var locate = window.location
	document.GetDev.DevInfo.value = locate

	var text = document.GetDev.DevInfo.value

	function IP1(str)
		{
			theleft = str.lastIndexOf("IP=") + 3;
			theright = str.lastIndexOf("IP=") + 6;
			return(str.substring(theleft, theright))
		}
	function IP2(str)
		{
			theleft = str.indexOf("IP=") + 3;
			return(str.substring(theleft, str.length))
		}
</SCRIPT>

<SCRIPT LANGUAGE="javascript">
{
	document.write(IP1(text) + " - \"" + IP2(text) + "\""); 
}
</SCRIPT>				

<table width="100%" border="1">
<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address = IP2(text)) ORDER BY IP_Address ASC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=20 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="DataNetworks"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&Type=202&Management=202&Shelf_Location=202&Remote=202&Shelf_Num=4&Circuit_ID=202&Pinged?=11&IP_Address=202&Shelf_Type=202&Term_CO=202&Term_CO_2=202&Term_Dev=202&Term_Shelf#=4&Transport=202&Intermapper_Location=202&Intmap=202&Alm=202&Model=202&Ver=202&Fan Iss=11&"
fp_iDisplayCols=20
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<%=fp_sQry%>
<%
Type1=FP_FieldVal(fp_rs,"Type")
%>
		<tr>
			<td>
			<%=FP_FieldVal(fp_rs,"Type")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Management")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Shelf_Location")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Remote")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Shelf_Num")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Circuit_ID")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Pinged?")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"IP_Address")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Shelf_Type")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Term_CO")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Term_CO_2")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Term_Dev")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Term_Shelf#")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Transport")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Intermapper_Location")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Intmap")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Alm")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Model")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Ver")%></td>
			<td>
			<%=FP_FieldVal(fp_rs,"Fan Iss")%></td>
		</tr>
<!--#include file="_fpclass/fpdbrgn2.inc"-->
</table>

<center>

Did it work <%=Type1%>




SirAldemar -> RE: Passing a variable (4/1/2005 16:49:53)

Follow-up:

I replaced the Query with the following and it worked great....

fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address =  '10.10.4.10') ORDER BY IP_Address ASC"


Now, how do I get the IP2(text) variable to work in the query?




dzirkelb1 -> RE: Passing a variable (4/1/2005 16:57:54)

Does the page display an error with the code or does it display no results? If it displays no results, with the little bit of code added it should write out the sql statement on your screen...what does it say?




SirAldemar -> RE: Passing a variable (4/1/2005 17:02:06)

10. - "10.10.4.10"

Database Results Wizard Error
The operation failed. If this continues, please contact your server administrator.


Did it work




dzirkelb1 -> RE: Passing a variable (4/1/2005 17:03:35)

I'm not sure if this will work or not, but its my last guess :(

fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address = &IP2(text)&) ORDER BY IP_Address ASC"

I am not sure cause it is a javascript function varialbe we're trying to call...(which I just now figured out is what you've been trying to get the whole time...sorry!!!)

Give that a whirl, best of luck...if that doesnt' work, hopefully someone will have the answer here or try google for passing varibles from javascript to asp (I looked a little bit, but the office is closing down now)

hope it works!




dzirkelb1 -> RE: Passing a variable (4/1/2005 17:05:17)

For that problem, everyone suggests going to this link http://www.frontpagewebmaster.com/m-175524/tm.htm to find out what the true error is...(its a sticky at top of this forum)




dzirkelb1 -> RE: Passing a variable (4/1/2005 17:10:21)

Ok, found something...not sure if its what you want to hear or not, but its this:

basically, can't call a clients side variable in asp (javascript to asp) unless its passed on a querysrting...so, somehow need to do a redirect to a new page with the javascript:

<%
response.redirect"page.asp?IP="<SCRIPT LANGUAGE="javascript">
var locate = window.location
document.GetDev.DevInfo.value = locate

var text = document.GetDev.DevInfo.value

function IP1(str)
{
theleft = str.lastIndexOf("IP=") + 3;
theright = str.lastIndexOf("IP=") + 6;
return(str.substring(theleft, theright))
}
function IP2(str)
{
theleft = str.indexOf("IP=") + 3;
return(str.substring(theleft, str.length))
}
</SCRIPT>%>

Now, I have absolutely no idea if that will work, but its a start

then, on the sql, it would be:

fp_sQry="SELECT * FROM DSLAMS WHERE (IP_Address = &request.querystring("IP")&) ORDER BY IP_Address ASC"

(I know the sql is correct, not sure on the link however)

The page I found that info is http://www.faqts.com/knowledge_base/view.phtml/aid/15755




SirAldemar -> RE: Passing a variable (4/1/2005 17:12:14)

10. - "10.10.4.9"

Database Results Wizard Error
Description: Undefined function 'IP2' in expression.
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine


Did it work




Spooky -> RE: Passing a variable (4/1/2005 21:07:58)

Whats the current code? it seems you are trying to use a client side script inside a server side script - it wont work.




SirAldemar -> RE: Passing a variable (4/1/2005 21:59:45)

OK.

I now understand that I can't use server side variables with client side scripts or vice-a-versa.

How can I get the main page to pass a variable to my display page?

here is the code I am using on the main page:
<script type="text/javascript" language="JavaScript">
	function OpenPage(ob) 
		{
			Variables = ob.options[ob.selectedIndex].value;

			window.open("status.html?"+Variables,'iFrame_Top');
			ob.selectedIndex = 0;
        }

</script>

</HEAD>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">

<script language="javascript">
	window.open("iFrame01.html","main");
</script>

<p align="center">
<font size="5" color="#0000FF"><b>Devices by Location</b></font><br>

<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM DSLAMS WHERE (Shelf_Location LIKE 'A%') ORDER BY Shelf_Location ASC,Remote ASC,Shelf_Num ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="DataNetworks"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="Shelf_Location"
fp_sMenuValue="IP_Address"
fp_sColTypes="&Type=202&Management=202&Shelf_Location=202&Remote=202&Shelf_Num=4&Circuit_ID=202&Pinged?=11&IP_Address=202&Shelf_Type=202&Term_CO=202&Term_CO_2=202&Term_Dev=202&Term_Shelf#=4&Transport=202&Intermapper_Location=202&Intmap=202&Alm=202&Model=202&Ver=202&Fan Iss=11&"
fp_iDisplayCols=20
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="10000" -->
<select style="width:100%; font-family:Courier New; font-size:8pt" name="menu" onchange="OpenPage(this)" size="1">
	<option selected>A</option>
	<!--webbot bot="AspInclude" clientside u-incfile="_fpclass/fpdbrgn1.inc" startspan --><!--#include file="_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="62210" -->
	<option VALUE="City=<%=FP_FieldHTML(fp_rs,"Shelf_Location")%>&Type=<%=FP_FieldHTML(fp_rs,"Type")%>&IP=<%=FP_FieldHTML(fp_rs,"IP_Address")%>">
	<script language="javascript">
		if ("<%=FP_FieldHTML(fp_rs,"Circuit_ID")%>"=="")
			{document.write("           ");}
		else
			{document.write("<%=FP_FieldHTML(fp_rs,"Circuit_ID")%>");}
	</script>
	<%=FP_FieldHTML(fp_rs,"Shelf_Location")%>-<script language="javascript">
		if ("<%=FP_FieldHTML(fp_rs,"Remote")%>"!="")
			{document.write("<%=FP_FieldHTML(fp_rs,"Remote")%>-");}
	</script><%=FP_FieldHTML(fp_rs,"Shelf_Num")%>
	[<%=FP_FieldHTML(fp_rs,"Type")%>]
	</option>
	<!--webbot bot="AspInclude" clientside u-incfile="_fpclass/fpdbrgn2.inc" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="62218" -->
</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></form>





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.140625