Shona Smith
08-18-2006, 04:57 AM
Hi
I have this code which works fine but the second box is not submitted to the database.
Any ideas would be great
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
strErrorUrl = ""
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("DropDown3_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(2)
Dim arFormDBFields0(2)
Dim arFormValues0(2)
arFormFields0(0) = "stage2"
arFormDBFields0(0) = "stage2"
arFormValues0(0) = Request("stage2")
arFormFields0(1) = "example"
arFormDBFields0(1) = "example"
arFormValues0(1) = Request("example")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
FP_SaveFieldToDB fp_rs, Now, "Timestamp"
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"ddbasic2.asp",_
"Return to the form."
End If
End If
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>
<body>
<form name="doublecombo" action="--WEBBOT-SELF--" method="POST">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="DropDown3" S-RecordSource="Results" U-Database-URL="../../../fpdb/DropDown3.mdb" S-Builtin-Fields="Timestamp" S-Builtin-DBFields="Timestamp" S-Form-Fields="stage2 example" S-Form-DBFields="stage2 example" startspan U-ASP-Include-Url="../../../_fpclass/fpdbform.inc" --><!--webbot bot="SaveDatabase" endspan -->
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Departments</option>
<option>CI</option>
<option>PER</option>
</select>
<select name="stage2" size="1">
<option>Cost Centre Codes</option>
<option value="557420">557420</option>
<option value="557123">557123</option>
</select>
<input type="submit" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("","")
group[0][1]=new Option("557420","")
group[0][2]=new Option("","")
group[1][0]=new Option("557420","")
group[2][0]=new Option("557123","")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
</body>
<body>
</body>
</html>
Thanks Shona
I have this code which works fine but the second box is not submitted to the database.
Any ideas would be great
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
strErrorUrl = ""
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("DropDown3_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(2)
Dim arFormDBFields0(2)
Dim arFormValues0(2)
arFormFields0(0) = "stage2"
arFormDBFields0(0) = "stage2"
arFormValues0(0) = Request("stage2")
arFormFields0(1) = "example"
arFormDBFields0(1) = "example"
arFormValues0(1) = Request("example")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
FP_SaveFieldToDB fp_rs, Now, "Timestamp"
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"ddbasic2.asp",_
"Return to the form."
End If
End If
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>
<body>
<form name="doublecombo" action="--WEBBOT-SELF--" method="POST">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="DropDown3" S-RecordSource="Results" U-Database-URL="../../../fpdb/DropDown3.mdb" S-Builtin-Fields="Timestamp" S-Builtin-DBFields="Timestamp" S-Form-Fields="stage2 example" S-Form-DBFields="stage2 example" startspan U-ASP-Include-Url="../../../_fpclass/fpdbform.inc" --><!--webbot bot="SaveDatabase" endspan -->
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Departments</option>
<option>CI</option>
<option>PER</option>
</select>
<select name="stage2" size="1">
<option>Cost Centre Codes</option>
<option value="557420">557420</option>
<option value="557123">557123</option>
</select>
<input type="submit" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("","")
group[0][1]=new Option("557420","")
group[0][2]=new Option("","")
group[1][0]=new Option("557420","")
group[2][0]=new Option("557123","")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
</body>
<body>
</body>
</html>
Thanks Shona