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

text box to populate select list

Status
Not open for further replies.

richey1

Technical User
Joined
Oct 5, 2004
Messages
184
Location
GB
Hi

I've got a online form with a select list as follows (there is also an option for some keywords entered as free text which i'll explain later)

Code:
b = b & " <div>"
b = b & "<label for=""cat"">Business Type<br />(Use Ctrl key for multiple selection(s))</label>" 
b = b & "<SELECT class=""a"" id=""cat"" name=""cat"" SIZE=""8"" tabindex=""18"" MULTIPLE>"
b = b & "<optgroup label=""Business Categories"">"

Dim arrValues, j
If ErrorMsg1 = "" Then
arrValues = split(Cat, ",")
else
arrValues = split(request.form("Cat"), ",")
end if
do while not objRS2.eof
  for j = 0 to UBound(arrValues)
    if trim(arrValues(j)) = objRS2("Col001") then
      b = b & "<OPTION selected value=""" & objRS2("Col001") & """>" & objRS2("Col001") & "</OPTION>"
      exit for
    end if
next
  if j > UBound(arrValues) then
    b = b & "<OPTION value=""" & objRS2("Col001") & """>" & objRS2("Col001") & "</OPTION>"
  end if
  objRS2.movenext
Loop

b = b & "</OPTGROUP>"
b = b & "</SELECT>"
b = b & " </div>"

The values for the categories are held in a sql table called BusCategories so objRS2 relates to........

Code:
strCat = "Select Col001 from BusCategories"
set objRS2 = objCon.execute(strCat)

what i'd like to do is expand the sql table with an extra column, a main category column so my table would look like
(for example)

Col001 newcolumn ID
Web Devlt IT 1
Computer Sales IT 2
Procees engineering IT 3

i would have another sql table for related words, for example

related ID CatID
Graphic design 1 1
Shopping carts 2 1

the user would still be presented with the full category list (i.e. Col0001) which they could multiple select as they do now
or
they could use a text box to search, so if they put in Graphic design, it would find the row tell the user to select Web Devlt from the list (or actually select it for them) and insert Graphic design into the Keywords1 text box.

I suppose i could do the categories on one page, then have a continue submit button to allow the user to fill out the rest of the form on a second asp page ?

I suppose a good start would be how i can use the resulting search result to populate the select list ? server-side preferably..............

regards
jacq
 
not completely sure what you are actually trying to do...
i guess you need to take a look at AJAX applications...

-DNG
 
thanks i will do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top