Make your first selection blank <option value="" selected></option>
You can then put any validation code you want (cfform validation,
javascript, or what-have-ya) to ensure the user selects an option other then
the first one, otherwise don't allow submission of the form.
Steven Semrau
SRA International, Inc.
Senior Member, Professional Staff
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Com: (703) 805-1095
DSN: (703) 655-1095
-----Original Message-----
From: Marc Garrett [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 23, 2001 3:18 PM
To: CF-Talk
Subject: problem with list box update
I have an update page on which I need to show "user friendly" terms in a
select box, even though the information in the table is actually a code
number (e.g., the info is saved as "010-000" but the user should see
"services.") The value from the select is then passed to a CFUPDATE on the
following page. I can get the update to work properly if the user changes
the value in the select box, but if she leaves the value unchanged the field
gets updated to the "friendly" word instead of leaving the code value
unchanged.
Thanks for any assistance. I have included code below my sig.
Regards,
Marc Garrett
Here's the code that populates the select list:
<select class="editBox" name="fldCategory1">
<option><cfoutput query="category_1">#fldCategory#</cfoutput></option>
<cfloop query="categories">
<option
value="<cfoutput>#fldCategoryID#</cfoutput>"><cfoutput>#fldCategory#</cfoutp
ut></option>
</cfloop>
</select>
Here's query category_1:
<cfquery datasource="datasource" name="category_1">
SELECT
tblContacts.fldContactID,
tblContacts.fldCategory1,
tblCategories.fldCategory,
tblCategories.fldCategoryID
FROM
tblContacts, tblCategories
WHERE
tblContacts.fldContactID LIKE '#id#'
AND tblCategories.fldCategoryID = tblContacts.fldCategory1
</cfquery>
The update on the next page is simply:
<cfupdate datasource="datasource" tablename="tblContacts">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists