1. _agx_'s method to pass back a variable to a select menu
<!--- query to get existing topics for the current documentID --->
<cfquery datasource="#ds#" name="GetSelectedTopics">
SELECT DocumentTopicID
FROM tbl_Document_Has_Topic
WHERE DocumentID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.documentID)#">
</cfquery>
<!--- convert the DocumentTopicID values to a list --->
<cfset form.SelectDocumentTopics = ValueList(GetSelectedTopics.DocumentTopicID)>
<cfselect name="SelectDocumentTopics"
size="8"
multiple="yes"
query="GetDocumentTopics"
queryPosition="below"
value="DocumentTopicID"
display="DocumentTopic"
selected="#form.SelectDocumentTopics#">
<option value="0">Choose topic:</option>
</cfselect>
2. examples of select menus, checkboxes, and radio buttons from my edit form at nbpts_registration.cfm
select menu:
<!--- script to make UserRoleID a required field --->
<script type="text/javascript">
function checkUserRole(theForm, theList, theValue) {
return (theValue == "" ? false : true);
}
</script>
User Role:
<cfselect id="UserRoleID" name="UserRoleID" size="1"
message="Enter User Role: Admin, Liaison, or Principal."
required="Yes"
onValidate="checkUserRole"
validateAt="onSubmit,onServer">
<option value=""> Choose User Role </option>
<option value = "5">Principal</option>
<option value = "3">Liaison</option>
<option value = "1">Administrative</option>
</cfselect>
Checkbox:
<p><input type="checkbox" name="DegreeBachelors"> Bachelors</p>
Radio button:
<p>3. Do you know how to create a PDF from Microsoft files? <span class="big rede31b23">*</span></p>
<p><input type="radio" name="CreatePDF" value="1"> Yes</p>
<p><input type="radio" name="CreatePDF" value="0"> No</p>
|