And if that doesnt work then you could always alter it to this:
<!--- *********** --->
<cfselect name="Template#ServiceItem
<!--- *********** --->
Main Topics
Browse All TopicsI have a table displaying several records. I’m trying to display one of the fields, “TemplateID”, in a select box, but I’m unable to force the correct value into the select box for each record. The first select box displays the correct value (i.e. the value of TemplateID in the first record), however, all subsequent records display the same value as the first record.
The select boxes are dynamically named to avoid naming conflicts. I *am* able to force different values into each select box if I equate the TemplateID value to #ServiceItem.CurrentRow#, but of course, that’s just diagnostic, not exactly helpful. I’ve ensured that each value of TemplateID does in fact exist in the select box’s option list.
I’ve been battling this problem for several days – a solution will be VERY APPRECIATED!
CFML and HTML Source is below.
Thanks in advance to the genius who solves this headache!
------------------
CFML Source:
<cfquery name="Templates" datasource="tmgcpa">
SELECT TemplateID, TemplateName
FROM dms_DocketTemplates
ORDER BY TemplateName
</cfquery>
<cfquery name="ServiceItems" datasource="tmgcpa">
SELECT *
FROM dms_qryClientServices
WHERE ClientID = '#URL.ClientID#'
</cfquery>
<form name="form1" method="post" action="">
<table width="740" border="1" cellspacing="0" bordercolor="#CCCCCC" class="SmallText">
<tr>
<td width="14"><input name="ClientID" type="hidden" id="ClientID" value="<cfoutput>#ServiceI
<td width="160"><strong>Servic
<td width="120"><strong>Freque
<td width="300"><strong>Templa
<td width="60"><strong>Anchor Date</strong></td>
<td width="80"><strong>Lead Time</strong></td>
<td width="80">Active</td>
</tr>
<cfoutput>
<cfloop query="ServiceItems">
<tr>
<td><strong>#ServiceItems.
<input name="ClientServiceID" type="hidden" id="ClientServiceID" value="#ServiceItems.Clien
</strong></td>
<td>#ServiceItems.ServiceI
<td>#ServiceItems.Interval
<td>
<!--- *********** --->
<select name="Template#ServiceItem
<cfloop query="Templates">
<option value="#Templates.Template
(#Templates.TemplateID#)</
</cfloop>
</select>
<!--- *********** --->
</td>
<td><input name="AnchorDate#ServiceIt
<td><input name="LeadTime#ServiceItem
<td>
<input <cfif (#ServiceItems.Active# EQ 1)>checked</cfif> type="checkbox" name="Active#ServiceItems.
</tr>
</cfloop>
</cfoutput>
</table>
</form> </td>
HTML Source:
<html><!-- InstanceBegin template="/Templates/MainT
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Mangold CPAs</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="2" rightmargin="0" bottommargin="0" leftmargin="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr bgcolor="#FFFFFF">
<td colspan="2" rowspan="2" valign="middle"><a href="mainMenu.cfm"><img src="graphics/tmgcpa_banne
<td width="100%" rowspan="2" valign="top"><!--DWLayoutE
<td width="296" height="24" valign="top" class="MediumText"><div align="right">
User: WDN
</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="26" valign="bottom"> <div align="right" class="MediumText">Decembe
</tr>
<tr bgcolor="#FFFFFF">
<td width="30" height="655" valign="top" class="SmallText"><!--DWLa
<!-- InstanceBeginEditable name="MainContent" -->
<td colspan="3" valign="top" bgcolor="#FFFFFF"><span class="menuText">MAIN
MENU > CLIENT > ADD MULTIPLE SERVICE ITEMS</span><br>
<br>
<span class="Title">Edit Client Service Items: {Handle}</span><br>
<br>
<span class="SmallText"><strong>
Service Items</a></strong></span><
<form name="form1" method="post" action="">
<table width="740" border="1" cellspacing="0" bordercolor="#CCCCCC" class="SmallText">
<tr>
<td width="14"><input name="ClientID" type="hidden" id="ClientID" value="1616871"></td>
<td width="160"><strong>Servic
<td width="120"><strong>Freque
<td width="300"><strong>Templa
<td width="60"><strong>Anchor Date</strong></td>
<td width="80"><strong>Lead Time</strong></td>
<td width="80">Active</td>
</tr>
<tr>
<td><strong>1.
<input name="ClientServiceID" type="hidden" id="ClientServiceID" value="51">
<input name="TemplateNo" type="hidden" id="TemplateNo" value="44">
</strong></td>
<td>Financial Statements</td>
<td>Monthly</td>
<td>
<select name="Template51" class="SmallText" id="Template" title="44">
<option value="13" >Tax Return - Individual - Level 4
(13)</option>
<option value="14" >Tax Return - Individual - Level 5
(14)</option>
<option value="46" >TemplateTest2
(46)</option>
<option value="47" >TemplateTest2
(47)</option>
<option value="48" >TemplateTest3
(48)</option>
<option value="49" >TemplateTest4
(49)</option>
<option value="50" >Test5
(50)</option>
<option value="44" selected>TestTemplate1
(44)</option>
<option value="45" >TestTemplate2
(45)</option>
</select>
</td>
<td><input name="AnchorDate51" type="text" class="SmallText" id="AnchorDate" value="1/1/04" size="10"></td>
<td><input name="LeadTime51" type="text" class="SmallText" id="LeadTime" value="1" size="4"></td>
<td>
<input checked type="checkbox" name="Active51" value="1"></td>
</tr>
<tr>
<td><strong>2.
<input name="ClientServiceID" type="hidden" id="ClientServiceID" value="52">
<input name="TemplateNo" type="hidden" id="TemplateNo" value="44">
</strong></td>
<td>Service Item #2</td>
<td>Daily</td>
<td>
<select name="Template52" class="SmallText" id="Template" title="44">
<option value="13" >Tax Return - Individual - Level 4
(13)</option>
<option value="14" >Tax Return - Individual - Level 5
(14)</option>
<option value="46" >TemplateTest2
(46)</option>
<option value="47" >TemplateTest2
(47)</option>
<option value="48" >TemplateTest3
(48)</option>
<option value="49" >TemplateTest4
(49)</option>
<option value="50" >Test5
(50)</option>
<option value="44" selected>TestTemplate1
(44)</option>
<option value="45" >TestTemplate2
(45)</option>
</select>
</td>
<td><input name="AnchorDate52" type="text" class="SmallText" id="AnchorDate" value="2/2/02" size="10"></td>
<td><input name="LeadTime52" type="text" class="SmallText" id="LeadTime" value="0" size="4"></td>
<td>
<input checked type="checkbox" name="Active52" value="1"></td>
</tr>
<tr>
<td><strong>3.
<input name="ClientServiceID" type="hidden" id="ClientServiceID" value="54">
<input name="TemplateNo" type="hidden" id="TemplateNo" value="44">
</strong></td>
<td>Service Item #5</td>
<td>Daily</td>
<td>
<select name="Template54" class="SmallText" id="Template" title="44">
<option value="13" >Tax Return - Individual - Level 4
(13)</option>
<option value="14" >Tax Return - Individual - Level 5
(14)</option>
<option value="46" >TemplateTest2
(46)</option>
<option value="47" >TemplateTest2
(47)</option>
<option value="48" >TemplateTest3
(48)</option>
<option value="49" >TemplateTest4
(49)</option>
<option value="50" >Test5
(50)</option>
<option value="44" selected>TestTemplate1
(44)</option>
<option value="45" >TestTemplate2
(45)</option>
</select>
</td>
<td><input name="AnchorDate54" type="text" class="SmallText" id="AnchorDate" value="3/3/03" size="10"></td>
<td><input name="LeadTime54" type="text" class="SmallText" id="LeadTime" value="0" size="4"></td>
<td>
<input checked type="checkbox" name="Active54" value="1"></td>
</tr>
<tr>
<td colspan="2"> <input type="submit" name="Submit" value="Update Service Items">
<input name="UpdateServiceItems" type="hidden" id="UpdateServiceItems" value="UpdateServiceItems"
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form> </td>
<!-- InstanceEndEditable --></tr>
<tr>
<td height="18" colspan="4" valign="top" class="SmallText"><div align="center"><font color="#999999">©
2005 </font></div></td>
</tr>
<tr>
<td height="19"> </td>
<td width="420"></td>
<td></td>
<td></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
And if that doesnt work then you could always alter it to this:
<!--- *********** --->
<cfselect name="Template#ServiceItem
<!--- *********** --->
have you validated teh query output to ensure that you are gettting three unique records and not just three records?
<cfquery name="ServiceItems" datasource="tmgcpa">
SELECT *
FROM dms_qryClientServices
WHERE ClientID = '#URL.ClientID#'
</cfquery>
if teh output of teh query is
blah blah blah 44 blah blah
blah blah blah 44 blah blah
blah blah blah 44 blah blah
then what you are gettting is correct
For some reason the nested loop might be having a problem with having two seperate TemplateID's
For a quick fix, just assign ServiceItems.TemplateID to a new variable name like below:
<cfset tempID = ServiceItems.TemplateID>
<cfloop query="Templates">
<option value="#Templates.Template
</cfloop>
-Jeff
Business Accounts
Answer for Membership
by: wulfshaydePosted on 2005-12-21 at 15:06:03ID: 15530697
Why not change:
s.ClientSe rviceID#" class="SmallText" id="Template" title="#ServiceItems.Templ ateID#"> ID#" <cfif #Templates.TemplateID# EQ #ServiceItems.TemplateID#> selected</ cfif>>#Tem plates.Tem plateName# option>
s.ClientSe rviceID#" class="SmallText" id="Template" title="#ServiceItems.Templ ateID#" query="Templates" display="TemplateName" value="TemplateID" selected="#ServiceItems.Te mplateID#" />
<!--- *********** --->
<select name="Template#ServiceItem
<cfloop query="Templates">
<option value="#Templates.Template
(#Templates.TemplateID#)</
</cfloop>
</select>
<!--- *********** --->
To:
<!--- *********** --->
<cfselect name="Template#ServiceItem
<!--- *********** --->