I have been wracking my brain on this one. A week ago, this was working
and now for some reason it is not. The only thing that changed was when
I backed up the dev database for this app, and then did a restore after
rebuilding the server, something happened with the backup so I had to
create all of the tables and SP's from scratch as well as re-input all
the data. What I am doing is populating a select list with departments
and their associated ID, and I am using a JS listener that, when
selecting a department, populates the contact and contact phone fields
in the form automatically. The problem is that it is putting the wrong
contact and phone number in these text fields. I viewed the source, and
the JS listener is populating itself with the correct information
(siteId and contact are correct, siteID and phone are correct) and the
select list has the correct siteID-department name association. My code
is below.
JS Listener:
<script type="text/javascript">
function Populate(Contacts)
{
var SiteContact = {};
var SitePhone = {};
<!--- Populate Site Contact Information --->
<cfloop query="qSelectAllSites">
SiteContact["#qSelectAllSites.SiteID#"] =
'#qSelectAllSites.Administrator#';
SitePhone["#qSelectAllSites.SiteID#"] =
'#qSelectAllSites.SitePhone#';
</cfloop>
// Listen for changes to the select box
document.OpenNewCase.SiteContact.value=SiteContact[Contacts];
document.OpenNewCase.SitePhone.value=SitePhone[Contacts];
}
</script>
A small snippett of what is being produced in the loop:
SiteContact["2"] = 'Dan MacDonald';
SitePhone["2"] = '868-2500';
SiteContact["12"] = 'Dave Smith';
SitePhone["12"] = '868-5400';
SiteContact["13"] = 'Dave Abdalla';
SitePhone["13"] = '868-6277';
SiteContact["15"] = 'Dr. Eric Johnston';
SitePhone["15"] = '868-5817';
These are the correct associations.
Select list:
<select name="SiteID" id="SiteID" onchange="Populate(this.selectedIndex)">
<option>
Select a site
</option>
<cfoutput query="qSelectAllSites">
<option value="#SiteID#">#SiteName#</option>
</cfoutput>
</select>
And a small sample of the select list output:
<option value="2">Baldy Mesa Elementary</option>
<option value="12">Chaparral High
School</option>
<option value="13">Desert View Independent
School</option>
<option value="15">District Office</option>
Again, the site ID and department are correct.
And here are the text boxes:
<cfoutput>
<input name="ContactName" type="text" id="SiteContact" />
</td>
</tr>
<tr>
<td>
<span>Contact Phone</span>
</td>
<td>
<input name="SitePhone" type="text" id="SitePhone" /> </cfoutput>
Thanks,
Bruce
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305771
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4