Good Morning,
I have been following this thread 333-1223333
I am kind of in the same boat as nonprogrammer.
I was able to find a javascript that redirects to an asp page when you check a checkbox.
Up to this point is all well and good, but when I try to pass the variable to the asp page that is where I am having a problem.
Could anyone help please?
Javascript (this page is saved as an html page)
Then I took Tarwn suggestion
and I did this
This is where I am having problems passing the variable
here is what the asp page looks like took this from nonprogrammer
I have been following this thread 333-1223333
I am kind of in the same boat as nonprogrammer.
I was able to find a javascript that redirects to an asp page when you check a checkbox.
Up to this point is all well and good, but when I try to pass the variable to the asp page that is where I am having a problem.
Could anyone help please?
Javascript (this page is saved as an html page)
Code:
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript"><!--
function redirect (form, group) {
var numberClicked = 0;
for (var i=0; i<form.elements.length; i++) {
if (form.elements[i].name == group && form.elements[i].type == 'checkbox' && form.elements[i].checked)
numberClicked++;
}
if (numberClicked <= 3) url = 'view1.asp'
else if (numberClicked <= 6) url = 'view1.asp';
else url = 'view1.asp';
location.href = url;
return false;
}
//--></script>
</head>
<body>
<form onSubmit="return redirect(this,'group1')">
<input type="checkbox" name="part1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="checkbox" name="group1">
<input type="submit" value="Submit">
</form>
</body>
</html>
Then I took Tarwn suggestion
Code:
strSQL = "SELECT productName, width, height, etc FROM Products WHERE productID IN (" & Request.Form("MyCheckboxField") & ")"
and I did this
Code:
Dim jschkbx = request.querystring("part1")
strSQL = "SELECT productName, width, height, etc FROM Products WHERE productID IN (" & Request.Form("MyCheckboxField") & ")"
This is where I am having problems passing the variable
here is what the asp page looks like took this from nonprogrammer
Code:
<%
'Dimension variables
jschkbx = request.querystring("part1")
Dim adoCon 'Holds the Database Connection Object
Dim myrs 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/Partsearch.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set myrs = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * From Parts WHERE ID IN (" & Request.Form("jschkbx") & ")"
'Open the recordset with the SQL query
myrs.Open strSQL, adoCon
%>
</head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
-->
</style><body text="#339933" link="#33FF00" vlink="#666666" alink="#666600" onLoad="MM_preloadImages('file:///P|/Inetpub/[URL unfurl="true"]wwwroot/aqpc/wb/images/overview.gif')">[/URL]
<!-- Begin form code -->
<p><img src="file:///P|/Inetpub/[URL unfurl="true"]wwwroot/aqpc/wb/images/dvlg.png"[/URL] width="217" height="87"> </p>
<p> </p><form name="form" method="post" action="comparisonprocess.asp">
<table width="100%" border=".25">
<tr>
<td width="15%"><img src="<%= myrs.Fields("pic")%>"></td>
<td width="32%">
<p>Part Number</p>
<p>
<%Response.Write ("<a href=""updateform.asp?id=")
Response.Write (myrs("id"))
Response.Write (""">" & myrs("id") & "</a>")%>
</p> </td>
<td width="1%"> </td>
<td width="17%"><%response.write (myrs("SubCategory"))%> </td>
<td width="1%"><%response.write (myrs("Diameter"))%> </td>
<td width="1%"><%response.write (myrs("height"))%></td>
<td width="1%"><%response.write (myrs("hub"))%></td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="1%"> </td>
<td width="20%"> </td>
</tr>
</table>
<p align="center"><strong>
<input type="submit" name="Submit" value="Submit">
</strong></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
<td><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
<table width="505" border="0">
<!--DWLayoutTable-->
<tr>
<td width="227" height="46" valign="top"><div align="center"><strong></strong>
</div></td>
<td width="7"></td>
<td width="257"></td>
</tr>
<tr>
<td height="12"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="46" colspan="2" valign="top"><div align="center"> </div></td>
<td></td>
</tr>
</table></form>
<body>
<p> </p>
<div align="center"> </div>
</body>
</html>
<%
'Reset server objects
myrs.Close
Set myrs = Nothing
Set adoCon = Nothing
%>