dynamic drop-down list

Results 1 to 4 of 4

Thread: dynamic drop-down list

  1. #1
    klovis Guest

    Default dynamic drop-down list

    I want to set up a knowledge base where users drill down using drop-down boxes to get to the solution they are after. For example, the first question asks a general question regarding the problem, ie printer-problem, MS-office problem, NT-problem etc. Then, depending on which option is chosen, the next set of questions will ask more detailed questions about that problem (again using drop-down list) say if it is a printer problem, the next list will ask whether it is a paper jam, toner problem, network problem etc, and then the next phase will attempt to answer the specific problem, if indeed an answer exists to the question. Is this feasible to do in ASP? Any code or examples would be welcome. <BR>thanks, <BR>k<BR> <BR> <BR> <BR> <BR> <BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    9

    Default RE: dynamic drop-down list

    Use this:<BR>sql = "SELECT * FROM YourTable"<BR>sql = sql & "WHERE problem= &#039general&#039 "<BR>set rs = database.execute(sql)<BR><BR>&#060;form method="POST" action="samePage.asp" name="cboProblem"&#062;<BR>&#060;select name="cboProblem" size="1"&#062;<BR>&#060;%On Error Resume Next<BR> rs.MoveFirst<BR> do while Not rs.eof<BR>%&#062; <BR>&#060;option value="&#060;% response.write <BR>rs.Fields("Problemtype").Value%&#062;"&#062; <BR>&#060;% response.write (rs.Fields("Problemtype")).Value%&#062;<BR>&#060;/option&#062;<BR>&#060;% rs.MoveNext <BR>loop %&#062; <BR>&#060;/select&#062;<BR>&#060;input type="submit" value="OK" name="cmdOk"&#062;<BR><BR>Then you pass the variable back to the same page and use something like:<BR><BR>If request.form("cmdOk") = "OK" Then<BR> problemtype = request.form("cboProblem")<BR> sql = "SELECT * FROM YourTable WHERE "<BR> sql = sql & "Problemtype = &#039" & problemtype & "&#039"<BR><BR>And then you construct the dropdown menu all over again using the new criteria.<BR>Hope this helped you a bit!<BR><BR><BR>

  3. #3
    klovis Guest

    Default RE: dynamic drop-down list

    I assume this way uses a single table to get all the data? What I had in mind was having a separate table for each phase, ie a general list of problems, then a second set of more detailed questions for each topic ie SecondRound_PrinterProblem, SecondRound_Software problem etc, so the table that the sql query gets its results from would have to be dynamically chosen. HOw can this fit in to your solution?<BR>thanks,<BR>k

  4. #4
    Join Date
    Dec 1969
    Posts
    9

    Default RE: dynamic drop-down list

    I guess you could start the same way, and use the same sql-query,<BR>only you put a variable for the tablename, like so:<BR><BR>If request.form("cmdOk") = "OK" Then<BR>problemtype = request.form("cboProblem")<BR>sql = "SELECT * FROM &#039" & problemtype % "&#039"<BR><BR>I havenĀ“t tried it, but it should work...<BR>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •