MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 575

Developing coldfusion mx applications
Table of Contents

Advertisement

<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.
3
View formpage.cfm in a browser.
4
The changes that you just made appear in the form.
Remember that you need an action page to submit values.
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>
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.
Dynamically populating list boxes
575

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents