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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

value not being passed

Status
Not open for further replies.

frogggg

Programmer
Jan 17, 2002
182
US
I have a page with a listbox. The user selects a value and the next page opens with more information about the selected value. This is my code:
<%
dim varlocation
varlocation = lstLocation.getText()
%>

<!--search button to pass value of variable-->
<a href=&quot;displayJobs.asp?Location=<%=varlocation%>&quot;>Search</a>

This is the error I'm getting:
Data type mismatch in criteria expression.
Also, in the URL, Location= the first value of the listbox instead of the selected one.

What am I doing wrong?
I would appreciate any help.
 
Try this:
<a
href=&quot;displayJobs.asp?Location=&quot;<%=varlocation%>>Search</a>
Uhgar
-- Alcohol and Calculus never mix! Do not drink and derive! --
 
Uhgar,

Thanks for your post but that wasn't it. Same error message, and now in the URL Location= is blank.

Any other ideas?
 
Try this:
<%
dim varlocation
varlocation = Request.Form(&quot;lstLocation&quot;)
Response.write (varlocation)
%>

I think the getText() syntax might be client side syntax. If you just request the value from the previous page, you should get something there.

 
JuanitaC,

varlocation=lstlocation.getText()
is on the same page as the listbox, because it's a dtc, which cannot be on a form.

I think it's supposed to be client-side syntax unless I'm making a mistake (which I obviously am or it would work!).

Any other ideas?
 
OK, but <% %> is server side syntax. I have pages with DTCs on as well, and I get the values client-side with this syntax:

varlocation=lstlocation.getText(lstlocation.selectedIndex)

but in client-side javascript functions (no <% %> tags), and with the selectedIndex as a parameter. See if that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top