MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 103

Table of Contents

Advertisement

Dynamically Populating List Boxes
3
4
Reviewing the code
The following table describes the highlighted code and its function:
Code
<cfquery name="GetDepartments"
datasource="CompanyInfo">
SELECT DISTINCT Location
FROM Departmt
</cfquery>
<select name="City">
<cfoutput query="GetDepartments">
<option
value="#GetDepartments.Location#">
#GetDepartments.Location#
</option>
</cfoutput>
</select>
<!-- radio buttons -->
<p>
Department:<br>
<input type="radio" name="Department" value="Training">Training<br>
<input type="radio" name="Department" value="Sales">Sales<br>
<input type="radio" name="Department"
value="Marketing">Marketing<br>
<input type="radio" name="Department" value="HR">HR<br>
</p>
<!-- check box -->
<p>
Contractor? <input type="checkbox" name="Contractor" value="Yes"
checked>Yes
</p>
<!-- reset button -->
<input type="reset" name="ResetForm" value="Clear Form">
<!-- submit button -->
<input type="submit" name="SubmitForm" value="Submit">
</form>
</body>
</html>
Save the page as formpage.cfm.
View formpage.cfm in a browser.
The changes that you just made appear in the form.
Remember that you need an action page to submit values.
Description
Get the locations of all departments in
the Departmt table. The DISTINCT
clause eliminates duplicate location
names from the returned query results.
Populate the City selection list from the
Location column of the GetDepartments
query. The control has one option for
each row returned by the query.
83

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 5

Table of Contents