SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Resource

Building Input Lists From Your Database


Sponsored Links
Developer's Paradise : Inside Technique :
Building Input Lists From Your Database
Submission by SiteExperts Staff

Go to the resource:
Building Input Lists From Your Database

Add to Assistant

Short Description
A simple ASP script that generates input lists from a database recordset.

Long Description
In this series, we explore the functions and utilities used to run and manage the SiteExperts.com site. We introduce a simple function we use to quickly generate input lists, either list boxes or radio/ checkbox groups, from a recordset.

Author
Scott isaacs
Date/ Version
10/17/1999
Submission URL
http://www.SiteExperts.com/tips/elements/ts25/page1.asp
Submission Date
Oct 17,1999
Last Update
Oct 17,1999
 

Discussion and Rate this Resource
Overall Rating: 4.4

ja928 on Sep 4, 2003 at 9:23:40 AMRating: 4

civory, Instead of just doing the Response.Write, use a Replace()

Dim theDefault
theDefault = Request("whatever value is selected")

Dim sDropDown
sDropDown = BuildListBox("SELECT","States","False",0,"",oRS,"state","state_name")

Replace(sDropDown, "VALUE=""" & theDefault & """", "VALUE=""" & theDefault & """ SELECTED"

 

civory on Sep 3, 2003 at 1:55:10 PMRating: 4
Is it possible when reloading the page to have the item selected display in the listbox, like the select Tag in HTML.
hendrix on Mar 8, 2002 at 5:26:58 AMRating: 4

Very useful script but I get an error if my sql returns a value that isn't an Integer. Does anyone know how to solve this??

The error is:

ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

frocco on Sep 25, 2001 at 7:13:13 AMNo Rating

How can I position in the list to the value I currently have in my database?

1,Apple  2,Orange, 3,Pear

if database field has a value of 2, I what to show the list with the default of orange.

Thanks

 

 

Magnum on May 27, 2001 at 11:15:36 PMRating: 5

This is a very useful article. It works for a drop down list box as well as Radio buttons, check boxes, and multi select list boxes. To make it properly work, the function call should be as follows: 

 Response.Write BuildListBox("input","cbpubs",true,8,"",rstPubs,"pub_id","pub_name") 

More Ratings/ Comments


To rate and comment on a resource, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password

Copyright © 1997-2008 InsideDHTML.com, LLC. All rights reserved.