fnDataRADIO()
DESCRIPTION
This function returns an HTML string which is a data-bound HTML RADIO
box. The box is bound to a query string which is passed to the
function. You can consult the documentation for the
'fnDataSELECT' function which is probably slightly better than this
documentation. A wrote this function when I had really not much
experience in this type of programming. A number of aspects of this
function and similar ones in the /eg/asp directory I consider really
silly. Most of these functions are probably obsolete anyway,
considering that Microsoft ASP is not likely to be a long lasting
scripting environment, and has probably already been superseded by
the whole .net shebangle.
SYNTAX
<%= fnDataRADIO(adoConnection, sLookupString, [sValueField],
[sDisplayField], [sSelectedValue], [sName], [aaConnect]) %>
EXAMPLE
<%@ Language=vbScript%>
<% Response.Buffer = true %>
Testing fnDataSELECT
RESULTS
A web page is produced which contains on it a 'Radio List'
(That is a list of little circles which are supposed to look
like the type of buttons that used to be on old radios for
changing channels). The items of the Radio List are
extracted from an Ms Sql Server Database Table according to
a Structured Query Language (SQL) query that is provided.
PARAMETERS
adoConnection-
an open ADO database connection. This allows connection pooling. If
there is no open DB connection then the sDatabaseDSN parameter can
be used instead.
CHANGE BELOW TO A STRING PARAMETER
sLookupString- This is the SQL query string that provides the values
and display elements for the list
box. Alternatively, this string can consist of the name of a
table or stored procedure (with or
without parameters) in the database.
[sValueField]- This is the field that supplies the values for the
VALUE attribute of the select box-
which are submitted with the form. (Default: First Field)
[sDisplayField]- This field supplies the elements/ strings which the
user will see in the select box.
[sSelectedValue]- The item in the select box which will be initially
selected when the page loads.
[sName]- The value for the NAME attribute of the select box
[aaConnect]- an array of information which is used to connect to the
database using ADO
aaConnect[0] {string} The database driver (Default 'sql server')
aaConnect[1] {string} The IP address of the database server (Default '(local)')
aaConnect[2] {string} A valid user name for the database (Default 'sa')
aaConnect[3] {string} A valid password for the User Name (Default 'max')
aaConnect[4] {string} The database Name (Default- the default database)
[bHasBlank] {boolean, default=true} determines whether the drop down
box will have a blank element or not
STATUS
This seems to be working but I really wouldn't count on it.
DEPENDENCIES
fnErrorMessage (DebugUtilities.asp) fnConvertArray(),
fnCheckForField()
CODE LAST MODIFIED 11 April 2000
PROGRAMMER Matthew Bishop
LOCATION
http://www.geocities.com/matth3wbishop/eg/asp/
DOCUMENTATION
http://www.geocities.com/matth3wbishop/eg/asp/
COMMENTS:
a) The dataSELECT function also includes three hidden form elements;
'hidOriginalValue' containing
the original value of the Select Box, and 'hidValueField'
containing the name of the field which is
used for the value attribute. 'hidDisplayField' containing the
name of the field which is displayed.
b) The number of options in the drop down box is limited to 1000
c) When assigning a value for sSelectedValue from a
Request.Querystring it was necessary to apply a
VBscript CSTR to get it to work (I have no idea why)
This whole scripting environment is almost certainly an enormous
waste of time, but it was an interesting learning experience for
me it the fight against chaos.