Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch for "hidden" input type

Status
Not open for further replies.

Beng79

Technical User
Jan 5, 2006
48
0
0
HK
Hi all,
I have used Querystring to display the list for editing: Modify Features.asp

<%
recstMod.Open "SELECT * from FuncFeat", connectMod

Do While Not recstMod.EOF
Response.Write(recstMod("FeatName")) & "<a href='ModifyFeatures_verify.asp?FeatID=" & recstMod("FeatID") & "'> Edit</a><br>"
recstMod.MoveNext
Loop
%>

In ModifyFeatures_verify.asp, it executes a SQL command based on the value you pass across in FeatID. It also accepts user input which are meant for updates to the DB when submitted

<form method="post" action="Modify Features.asp">
<input type="hidden" name="FeatID" value="<% = recstMod("FeatID") %>">
Project ID</span>:</font></b>
<input type="text" name="ProjID" value="<% = rs("ProjID") %>" size="10" tabindex="1"></p>
Feature Name</font></b></span><b><font face="Arial" color="#333399">:</font></b>
<input type="text" name="FeatureName" value="<% = rs("FeatName") %>" size="40" tabindex="2"></p>
<p align="left"><br>

<%
Dim connectMod, recstMod
Dim FeatureID

Set connectMod = Server.CreateObject("ADODB.Connection")
connectMod.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))

Set recstMod = Server.CreateObject("ADODB.RecordSet")
recstMod.Open "SELECT ProjID, FeatName FROM FeatName WHERE FeatID=" & Request.QueryString("FeatID")

recstMod.close
Set recstMod = Nothing
Set connectMod = Nothing

Response.Redirect("Modify Features.asp")
%>

When I try to run ModifyFeatures_verify.asp, this error is displayed:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch

It occurs on the line:
<input type="hidden" name="FeatID" value="<% = recstMod("FeatID") %>">

 
Looks like ' recstMod("FeatID") ' is out of scope on the <input type.... line. Looks like you should be using the querystring value at that point.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
What do you mean by out of scope? What should it be replaced with in terms of coding?
 
You should consider using Option Explicit at the top of your code, it will point out wat variables your using that haven't been initialized. That note aside, I think you issue is here:
Code:
<input type="hidden" name="FeatID" value="<% = [highlight]recstMod("FeatID")[/highlight] %>">
Project ID</span>:</font></b>
<input type="text" name="ProjID" value="<% = [highlight]rs("ProjID")[/highlight] %>" size="10" tabindex="1"></p>

Which one is really the name of your recordset object on this second page?

barcode_1.gif
 
The recordset should be recstMod, I have corrected it. I have also added in Option Explicit.
But the error msg still exist.

Now the code looks like this for ModifyFeatures_verify.asp:
<form method="post" action="Modify Features.asp">
<input type="hidden" name="FeatID" value="<% = recstMod("FeatID") %>">
<p align="left"><b><font face="Arial" color="#333399">
<span style="vertical-align: middle">Project ID</span>:</font></b>
<input type="text" name="ProjID" value="<% = recstMod("ProjID") %>" size="10" tabindex="1"></p>
<p align="center"><span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;Feature Name</font></b></span><b><font face="Arial" color="#333399">:</font></b>
<input type="text" name="FeatureName" value="<% = recstMod("FeatName") %>" size="40" tabindex="2"></p>
<p align="left"><br>

<%
Dim connectMod, recstMod
Dim FeatureID

Set connectMod = Server.CreateObject("ADODB.Connection")
connectMod.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))

FeatureID = Request.QueryString("FeatID")
Set recstMod = Server.CreateObject("ADODB.RecordSet")
recstMod.Open "SELECT ProjID, FeatName FROM FuncFeat WHERE FeatID=" & FeatureID, connectMod

recstMod.close
Set recstMod = Nothing
Set connectMod = Nothing

Response.Redirect("Modify Features.asp")
%>

Should I also include a update statement so whatever is entered is being modified in the Database table?
 
everything looks ook...i would suggest putting request.write statements in order to debug and see if you are getting all the variables populated correctly...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top