Getting list of drop down menu item from database

Results 1 to 6 of 6

Thread: Getting list of drop down menu item from database

  1. #1
    Saji Krishnan Guest

    Default Getting list of drop down menu item from database

    I have a Selection field (drop down menu) on my page. I want the lists of items to come from database table

  2. #2
    KLg Guest

    Default RE: Getting list of drop down menu item from datab

    One way.<BR><BR>Response.Write "&#060;select name=selMenu&#062;"<BR>Do While Not oRS.EOF<BR>&nbsp&nbspResponse.Write "&#060;option value=&#039" & Trim(oRS("menuitem")) & "&#039&#062;" & _<BR>&nbsp&nbsp&nbsp&nbspTrim(oRS("menuitem")) & _<BR>&nbsp&nbsp&nbsp&nbsp"&#060;/option&#062;"<BR>Loop<BR>Response.Write "&#060;/select&#062;"

  3. #3
    Saji Krishnan Guest

    Default Thanx

    Let me try if it is working. Could u help me with the question on Auto completion of text.(That&#039s my wife&#039s question) We have a search form with name field when a person tries to type a name it should autocomplete it by taking the most matching field from a database table.

  4. #4
    KLg Guest

    Default RE: I don't think it's practical..

    Autocomplete would have to happen on the client&#039s machine so it implies that all of the names would have to be downloaded to the browser (unless you post the form between keystrokes!). Then you would need client-side code to search for the nearest match and complete the text, as they typed. I could imagine you could download the names in a hidden text field and write a lot of code to search it, but it would be difficult to do it and keep it compatible..<BR><BR>There is a built-in autocomplete for IE forms as an option in the Options menu, but it would autocomplete with the last entry attempted. Maybe the clients would settle for that?<BR><BR>Another option would be to use &#060;select&#062; tags so at least as they type the first letter it selects the first entry beginning with the letter. Typing &#039S&#039 multiple times would take you through the S&#039s. But I don&#039t know if that&#039s what they need, if they are searching for something that might not be there...<BR><BR>Anyone else?

  5. #5
    Saji Krishnan Guest

    Default Another related problem

    The table i am using has 2 fields (deptID and DeptName) The DeptNames should come in the list box and value for each item in the listbox should be the corresponding DeptID no. How do i put the value for each choice in the list box?<BR>

  6. #6
    KLg Guest

    Default RE: Another related problem

    You could use the deptID as the value and DeptName as the displayed text. When the page is posted, the Request would just contain the chosen deptID.<BR><BR>Response.Write "&#060;select name=selMenu&#062;"<BR>Do While Not oRS.EOF<BR>&nbsp&nbspResponse.Write "&#060;option value=&#039" & Trim(oRS("deptID")) & "&#039&#062;" & _<BR>&nbsp&nbsp&nbsp&nbspTrim(oRS("DeptName")) & _<BR>&nbsp&nbsp&nbsp&nbsp"&#060;/option&#062;"<BR>Loop<BR>Response.Write "&#060;/select&#062;"

Posting Permissions

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