Fishing for search ideas...

diver
08-05-2002, 08:40 PM
I'm doing an intranet web site that will require almost constant need of a search device to create SQL statements... there are up to about 5 or 6 arguments that are optional for each search.

It seems that using the combo boxes in asp pages is very tedious.. and there is apparently no way to dynamically create the content in a particular combo box based on the selection from another combo box. The interactivity... well... it seems... sucks.

Perhaps there is a way. Dunno.

I'm also thinking... avoid the confusion and just do an ActiveX control in vb. I can code all the logic there... hit my stored procedures... just do about everything I want.

Anybody have any advice?

Thanks
diver

Thinker
08-05-2002, 08:53 PM
I have to admit, the activex control sounds good to me. You might
be surprised at what is possible with client-side javascript, but it
sure is a lot of work to get it right.

Rezner
08-05-2002, 08:59 PM
Well, there are several things you can do. You could use ASP.NET to achieve some truly dynamic interaction. However, if you want a basic ASP page, then you can create dynamic combo boxes like you alluded to. To do this, you would use JavaScript. I however, think it's too much of a pain -- so I just use a checkbox by each combobox. If the user wants to include the item in the search, they check the box and select the item from the list. Then, on page called something like makefilter.asp you could have code to generate part of the SQL statement. Here's an example of what I'm talking about:Private Sub GenerateFilter(strField)

'if the box is checked on the calling form then...
if Request("chk" & strField) = "on" then

'Get the value from the combobox and
'add it to the string
strFilter = _
strFilter & "[Movies].[" & strField & "]=" & _
request("cbo" & strField) & " AND "

end if

End Sub

'Check these fields
GenerateFilter "Genre"
GenerateFilter "Rating"
GenerateFilter "Year"

If strFilter <> "" then
'Snip off the last AND statement, enclose it, and then
'store in session cookie
Session("Filter") = "(" & Left(strFilter,Len(strFilter)-5) & ")"

'redirect and apply the filter
response.redirect "default.asp?filter=yes"
else

'Clear the session cookie
Session("Filter") = ""

'redirect with no filter to apply
response.redirect "default.asp?filter=no"
end if

So, on the calling form I'd have checkboxes called chkGenre, chkYear, and chkRating. And then comboboxs calld cboGenre, cboYear, and cboRating. The combos have their VALUE properties set to reference the numerical ID fields in the database. If the corresponding checkbox is checked, then the selected VALUE from the combo is added to the filtered SQL statement.

diver
08-05-2002, 10:38 PM
Hmm.
Well... I see... so you are firing an asp page after they click the proper boxes and click the submit button or something.

The main hangup I have is that I don't see a way to capture a combo box after click, or click event. If I could... heck, then I could fire an asp page like that, and dynamically load each box, right? that kind of technique would not be too far from your idea.

The ActiveX is so easy to do because I can do vb so much faster. But the asp script is cleaner.

thoughts?

diver

Rezner
08-05-2002, 11:27 PM
If you want to submit the combo value upon change, then give this a whirl:<form name=frmTest action="NextPage.asp" method=POST>
<select name=ComboName size=1 onChange="frmTest.submit();" >
<option value="1">Numbers
<option value="2" SELECTED>Fruit
<option value="3">Animals
</select>
<form>

JIMcFadyen
08-06-2002, 10:29 AM
Remote scripting offers the ability to do this, I found it quite effective for a similar drilldown. It is a bit tricky to get going but well worth the effort for the functionality.

Microsoft MSDN Article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rmscpt/html/rmscpt.asp

Quick Guide:
http://www.developerfusion.com/show/2404/

diver
08-06-2002, 11:41 AM
Thanks for the link.
I printed it out... it was about 15 pages in Word.

Don't know if I can understand it... I'll see what happens.

diver

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum