Overview
CF_RelatedSelectsControl is a ColdFusion Custom Tag that provides an unlimited number of chained or related select input controls.
The component is perfect for drilling down through different categories of information and uses the XMLHttpRequest() method to load the data without refreshing the main content window.
CF_RelatedSelectsControl can be used with a database set of queries, with flat data or using a combination of ColdFusion functions to enable Lists, Arrays and Structures to be used to drill through data.
User Interface
The control uses a set of styles to provide a quick and convenient method of changing the look and feel of the component.
You can use a set of pre-defined styles or quickly and easily create your own.
Compatability
CF_RelatedSelectsControl is compatible with the following:
- ColdFusion - CF4.5.2 , CF5.0 , CF6.1 , CF7.0, CF8
- Client Side Browsers - Internet Explorer 5.5/6+ , Mozilla / FireFox 1a+ , Netscape 7+
How to use the Tag: Using A Database:
<script>
function callbackFunction(str) {
alert("Callback:" + str);
}
</script>
<cf_dccom callbackfunction="callbackFunction"
component="relatedSelectsControl"
datasource="www-relatedSelectsDemo-MsAccess"
username=""
password=""
startSQL="SELECT DISTINCT region AS theValue,region AS theDisplay
FROM tblLocations
ORDER BY region">
<cf_dccom id="region"
name="region"
display="Choose A Region"
sql="SELECT DISTINCT smo AS theValue,smo AS theDisplay
FROM tblLocations
WHERE region='##region##'
ORDER BY smo">
</cf_dccom>
<cf_dccom id="smo"
name="smo"
display="Choose a SMO"
sql="SELECT DISTINCT ssc AS theValue,ssc AS theDisplay
FROM tblLocations
WHERE region='##region##' AND smo='##smo##'
ORDER BY ssc">
</cf_dccom>
<cf_dccom id="ssc"
name="ssc"
display="Choose a SSC"
sql="SELECT DISTINCT ident AS theValue,ident AS theDisplay
FROM tblLocations
WHERE region='##region##' AND smo='##smo##' AND ssc='##ssc##'
ORDER BY ident"></cf_dccom>
<cf_dccom id="ident"
name="ident"
display="Choose a ident"
sql="SELECT DISTINCT facility AS theValue,facility AS theDisplay
FROM tblLocations
WHERE region='##region##' AND smo='##smo##'
AND ssc='##ssc##' AND ident='##ident##'
ORDER BY facility"></cf_dccom>
<cf_dccom id="facility"
name="facility"
display="Chose a facility"></cf_dccom>
</cf_dccom>
Using Data Supplied To Tag:
<script>
function callbackFunction(str) {
alert("Callback:" + str);
}
</script>
<cf_dccom callbackfunction="callbackFunction" component="relatedSelectsControl">
<cf_dccom id="country" name="country"
display="Choose A Country" changes="city" value="Please choose..."></cf_dccom>
<cf_dccom text="Ireland" value="Ireland" parent="country"></cf_dccom>
<cf_dccom text="England" value="England" parent="country"></cf_dccom>
<cf_dccom text="Wales" value="Wales" parent="country"></cf_dccom>
<cf_dccom text="Scotland" value="Scotland" parent="country"></cf_dccom>
<cf_dccom id="city" name="city"
display="Choose A City" changes="town" value="Please choose..."></cf_dccom>
<cf_dccom text="Dublin" value="Dublin" relatedTo="Ireland" parent="city"></cf_dccom>
<cf_dccom text="Cork" value="Cork" relatedTo="Ireland" parent="city"></cf_dccom>
<cf_dccom text="Limerick" value="Limerick" relatedTo="Ireland" parent="city"></cf_dccom>
<cf_dccom text="London" value="London" relatedTo="England" parent="city"></cf_dccom>
<cf_dccom id="town" name="town"
display="Choose A Town" changes="fastFood" value="Please choose..."></cf_dccom>
<cf_dccom text="Glanmire" value="Glanmire" relatedTo="Cork" parent="town"></cf_dccom>
<cf_dccom text="City" value="City" relatedTo="Cork" parent="town"></cf_dccom>
<cf_dccom text="Douglas" value="Douglas" relatedTo="Cork" parent="town"></cf_dccom>
<cf_dccom text="Midleton" value="Midleton" relatedTo="Cork" parent="town"></cf_dccom>
<cf_dccom text="Finglis" value="Finglis" relatedTo="Dublin" parent="town"></cf_dccom>
<cf_dccom text="Brixton" value="Brixton" relatedTo="London" parent="town"></cf_dccom>
<cf_dccom id="fastFood" name="fastFood"
display="Choose A Restraunt" changes="foodType" value="Please choose..."></cf_dccom>
<cf_dccom text="McDonalds" value="McDonalds" relatedTo="Midleton" parent="fastFood"></cf_dccom>
<cf_dccom text="McDonalds" value="McDonalds" relatedTo="City" parent="fastFood"></cf_dccom>
<cf_dccom text="McDonalds" value="McDonalds" relatedTo="Douglas" parent="fastFood"></cf_dccom>
<cf_dccom text="KCs" value="KCs" relatedTo="Douglas" parent="fastFood"></cf_dccom>
<cf_dccom text="Mr. Dees" value="Mr. Dees" relatedTo="Glanmire" parent="fastFood"></cf_dccom>
<cf_dccom text="Burger King" value="Burger King" relatedTo="City" parent="fastFood"></cf_dccom>
<cf_dccom text="KFC" value="KFC" relatedTo="Brixton" parent="fastFood"></cf_dccom>
<cf_dccom id="foodType" name="foodType"
display="Choose A Food Type" value="Please choose..."></cf_dccom>
<cf_dccom text="Burger" value="Burger" relatedTo="McDonalds" parent="foodType"></cf_dccom>
<cf_dccom text="Chinese" value="Chinese" relatedTo="Mr. Dees" parent="foodType"></cf_dccom>
</cf_dccom>
Full list of Tag Attributes:
| STYLE |
[String ] |
Style to use for rendering component |
| DATASOURCE |
[String ] |
Datasource to database if using database mode |
| USERNAME |
[String ] |
Username to database if using database mode |
| PASSWORD |
[String ] |
Password to database if using database mode |
| CELLSPACING |
[Integer ] |
Table cellspacing |
| CELLPADDING |
[Integer ] |
Table cellpadding |
| SHOWBUTTON |
[Yes|No ] |
Show button? |
| BUTTONTEXT |
[String ] |
Button text |
| SHOWTITLE |
[Yes|No ] |
Show title? |
| TITLE |
[String ] |
Title text |
| STARTSQL |
[SQL statement ] |
Start SQL if using database |
| CALLBACKFUNCTION |
[JS Function Name ] |
Javascript function call when button hit |
| CONTROLNUMBER |
[Integer ] |
Used if using multiple controls on one page | Sub Node Attributes
| NAME |
[String ] |
Form element Name - Passed as form data if required |
| ID |
[String ] |
Form element Id - Used to further extend functionality through JS |
| DISPLAY |
[String ] |
Help text to inform user what they are selecting |
| VALUE |
[String ] |
Initial select contents - e.g: Please choose... |
| TEXT |
[String ] |
If not database mode, text of node |
| PARENT |
[String ] |
If not database mode, parent owning group name |
| RELATEDTO |
[String ] |
If not database mode, related to sub group name |
| CHANGES |
[String ] |
If not database mode, name of group to change | Online demos and examples:
|