Go Back  Xtreme Visual Basic Talk > Other Languages > Web Programming > Search function not working, urgent help needed


Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2004, 08:19 AM
simflex simflex is offline
Centurion
 
Join Date: Jul 2003
Posts: 131
Default Search function not working, urgent help needed


Dear all, I ask for your forgiveness for the huge amount of code I am going to dump.

I believe my problem (which I am about to explain) lies with either toolbar.js or search.asp.

The process flow is as follows:

The user clicks on index.asp and a page called top_bar.asp opens up and asks the user to select a search option.
Depending on the user's choice, a javascript function called function openSearch() (which is in toolbar.js) is invoked.

Depending on your search type, search.asp is called.
Say for instance, you want to search for address, once you select "Address" under Search by (top_bar.asp), toolbar.js is supposed to determine that you want to search by address by calling search.asp to open the "Enter Address" search box.

So far, after selecting say, address as a search option, search.asp is invoked but instead of opening the search box to search for address, it always returns blank.

I just can't figure out where the problem is coming from.

Here are the toolbar.js and search.asp pages.

Please, please, I am begging for your assistance.
This has stumped me now for 2 days.


************
toolbar.js
***********
<language="JavaScript">
function openSearch() {
var search_type = top.top_bar.document.buttonForm.search.options[top.top_bar.document.buttonForm.search.selectedIndex].value;
window.open("search.asp?atype="+search_type,"searchWin","width=500,hei ght=400,scrollbars,resizable,status");
top.top_bar.document.buttonForm.search.selectedIndex = 0;
}
</script>

************
search.asp
***********
Code:
<html> <head><title>Search</title> <script language="javascript" src="toolbar.js"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body onLoad='window.focus()'> <% dim atype Response.Write "<div align='center'>" select case atype case "owner" Response.Write "<font size='-1'>Enter name (e.g., smith john)</font><br>" Response.Write "<form name='owner_search' method='post'>" Response.Write "<input type='text' name='owner' size='20'>" Response.Write "<input type='submit' name='action' value='search'>" Response.Write "<input type='hidden' name='actionh' value='search'>" Response.Write "</form>" case "pin" Response.Write "<font size='-1'>Enter parcel PIN:</font><br>" Response.Write "<form name='owner_search' method='post'>" Response.Write "<input type='text' name='pin' size='20'>" Response.Write "<input type='submit' name='action' value='search'>" Response.Write "<input type='hidden' name='actionh' value='search'>" Response.Write "</form>" case "address" Response.Write "<font size='-1'>Enter the address</font><br>" Response.Write "<form name='situs_search' method='post'>" Response.Write "<input type='text' name='situs' size='20'>" Response.Write "<input type='submit' name='action' value='search'>" Response.Write "<input type='hidden' name='actionh' value='search'>" Response.Write "</form>" Response.Write "<i><Font size='2' color=#660066><B>Do not abbreviate any word in street name <br>" Response.Write " If you have problems try just a part of the street name<br>" Response.Write " ex. '141 Pryor' -- finds 141 PRYOR SRTEET SW, <br>" Response.Write " '5165 WELCOME ROAD' -- finds 5165 WELCOME ALL ROAD</font></i>" case "street" Response.Write "<font size='-1'>Enter street name</font><br>" Response.Write "<form name='situs_search' method='post'> " Response.Write "<input type='text' name='street' size='20'>" Response.Write "<input type='submit' name='action' value='search'>" Response.Write "<input type='hidden' name='actionh' value='search'>" Response.Write "</form>" case "landlot" response.write("<form name='landlot_search' method='post'>" &_ "Enter tax district <select name='dist' size='1'>" &_ "<option value='11'>1-1</option>" &_ "<option value='12'>1-2</option>" &_ "<option value='21'>2-1</option>" &_ "<option value='22'>2-2</option>" &_ "<option value='06'>06</option>" &_ "<option value='07'>07</option>" &_ "<option value='08'>08</option>" &_ "<option value='09C'>09C</option>" &_ "<option value='09C'>09F</option>" &_ "<option value='13'>13</option>" &_ "<option value='14'>14</option>" &_ "<option value='14F'>14F</option>" &_ "<option value='15'>15</option>" &_ "<option value='17'>17</option>" &_ "<option value='18'>18</option>" &_ "</select>" &_ "and land lot <input type='text' name='landlot' size='4'>" &_ "<input type='submit' name='action' value='search'>" &_ "<input type='hidden' name='actionh' value='search'>" &_ "</form>") end select response.write "</div>" response.write atype response.end IF actionh = "search" Then Select Case atype Case "address" %><!--#include file="situs_search.asp"--><% End Select End If %> <body> <html>
Reply With Quote
  #2  
Old 02-24-2004, 08:51 AM
Syko10-96's Avatar
Syko10-96 Syko10-96 is offline
Contributor
 
Join Date: Oct 2002
Location: Virginia, USA
Posts: 716
Default

Hello,

I believe you need to set atype to your passed in querystring...
Code:
atype = Request.QueryString("atype")

hope this helps

p.s. I don't think you can perform dynamic includes like you're trying to do at the bottom of your code... I've seen a few posts on here about that before...
Reply With Quote
  #3  
Old 02-24-2004, 09:16 AM
simflex simflex is offline
Centurion
 
Join Date: Jul 2003
Posts: 131
Default

It worked beautifully.
Thanks a bunch!
Reply With Quote
  #4  
Old 02-24-2004, 09:31 AM
simflex simflex is offline
Centurion
 
Join Date: Jul 2003
Posts: 131
Default

p.s. I don't think you can perform dynamic includes like you're trying to do at the bottom of your code... I've seen a few posts on here about that before

You are right about this.
Do you have any idea how to fix this?

Second, when I perform a search, it doesn't appear like any values are being passed to the search page.

For instance, I enter 2355 Mansel Drive in address search, it does nothing.
Reply With Quote
  #5  
Old 02-24-2004, 09:50 AM
Syko10-96's Avatar
Syko10-96 Syko10-96 is offline
Contributor
 
Join Date: Oct 2002
Location: Virginia, USA
Posts: 716
Default

You can't "fix" ths include problem, however if I understand your page correctly...

It appears that you are trying to pass your search string to situs_search.asp... If this is correct, then you should be setting the "action" attribute of your forms to "situs_search.asp" as opposed to including it... Since you're using "post" as the method of all of your forms, you'll be able to access the value(s) being passed to situs_search.asp by using Request.Form("FormControlNameGoesHere")

Hope this helps
Reply With Quote
  #6  
Old 02-24-2004, 10:57 AM
simflex simflex is offline
Centurion
 
Join Date: Jul 2003
Posts: 131
Default

Thanks again, partner.
Just one last question.

Looking at the search.asp with the case statements,
the control here would be situs_search, right?
I don't know why it isn't working.
Reply With Quote
  #7  
Old 02-24-2004, 11:02 AM
Syko10-96's Avatar
Syko10-96 Syko10-96 is offline
Contributor
 
Join Date: Oct 2002
Location: Virginia, USA
Posts: 716
Default

No problem!

The controls I'm referring to are the <input> and <select> tags...

For example: if you were doing your address search, you'd refer to Request.Form("situs") to get the value that the user entered... If you were doing your landlot search, you'd refer to Request.Form("dist") to get the value the user selected...

In other words, you have to Request.Form() whatever the name of the control is you're trying to get the value for...

Make sense now?
Reply With Quote
  #8  
Old 02-24-2004, 11:12 AM
simflex simflex is offline
Centurion
 
Join Date: Jul 2003
Posts: 131
Default

Yes, it does.
Your help is truly appreciated.
The reason all these problems are cropping up is because I just translated 3 php codes into asp including the include statement we are talking about.
And by the way, I used situs = request("situs").
I just wanted to isolate the problems.
Thanks again!
Reply With Quote
  #9  
Old 02-24-2004, 11:22 AM
Syko10-96's Avatar
Syko10-96 Syko10-96 is offline
Contributor
 
Join Date: Oct 2002
Location: Virginia, USA
Posts: 716
Default

Glad I could help

Just FYI - the reason I specify Request.Form() and Request.QueryString() is that it makes it easier for me to tell where the item being requested is from. Incidentally, if you don't specify where you're requesting from, IIS checks in the following order: QueryString, Form, Cookies, ClientCertificate, ServerVariables
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the handle of a combo-box list. meteo API 4 02-20-2004 11:20 AM
need help! i'm a beginner geekool General 7 04-26-2003 12:44 AM
Shareware Registry Protection Technigue karachi999 General 2 01-21-2002 02:40 PM
MS Winsocket gibson General 3 07-20-2001 10:03 AM
link function to textboxes golash General 2 05-03-2001 11:57 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->