Hi all
I have two queries, the first one to select all information about companies from the database to show in my cfform and cfgrid and the second one to display a list of sectors that I use in a select. They both work fine.
company.sectorid is an integer to represent a sector name and this value is "connected" to sector.sectorid where there is a column called sector.sector that has the name of the sector.
I can show the names of the sector in cfgridcolumn (using SECTOR).
I can also output the sectorid (integer) in a cfinput. However, I cannot seem to output the sector (name) in the cfinput. I have tried using sector instead of sectorid in the field but to no avail. Why does it show the name correctly in the cfgridcolumn but as an integer in the cfinput? Thank you
<!--- -QUERIES -->
<cfquery name="qNames" datasource="sales">
select * from COMPANY, sector
where COMPANY.sectorid = sector.sectorid
<cfif structKeyExists(url,"sectorID")>
and sector.sectorid = #url.sectorid#
</cfif>
</cfquery>
<CFQUERY name="sector" datasource="sales">
SELECT sectorId, sector
FROM sector
ORDER BY sector
</CFQUERY>
<!--- OUTPUT SELECTED COLUMNS IN CFGRID--->
<cfform format="flash" skin="haloorange">
<cfgrid name="UsersGrid" format="flash"
query="qNames" width="1000" rowheaders="No"
onchange="for (var i:Number = 0; i<STATE.length; i++) {if (STATE.getItemAt([i]).data == UsersGrid.selectedItem.STATE)
STATE.selectedIndex = i} for (var i:Number = 0; i<MEETINGTIME.length; i++) {if (MEETINGTIME.getItemAt([i]).data ==
UsersGrid.selectedItem.MEETINGTIME) MEETINGTIME.selectedIndex = i}
for (var i:Number = 0; i<DEPT.length; i++) {if (DEPT.getItemAt([i]).data == UsersGrid.selectedItem.DEPT)
DEPT.selectedIndex = i}
for (var i:Number = 0; i<CITY.length; i++) {if (CITY.getItemAt([i]).data == UsersGrid.selectedItem.CITY)
CITY.selectedIndex = i}">
<cfgridcolumn name="RANKING" width="50"header="Rank">
<cfgridcolumn name="COMPANY" width="150" header="Company">
<cfgridcolumn name="DEPARTMENT" width="150" header="Department" display="true">
<cfgridcolumn name="FIRSTNAME" width="150" header="Contact Name">
<cfgridcolumn name="POS" header="Position" width="160" display="true">
<cfgridcolumn name="SECTOR" width="120" header="SECTOR" display="TRUE">
</cfgrid>
<!--- THE CFINPUT--->
<cfformgroup type="tabnavigator" width="1000">
<cfformgroup type="page" label="Details: #dateFormat(now(), 'mmm dd, yyyy')# : #qNames.RecordCount# Companies">
<cfformgroup type="horizontal">
<cfinput type="TEXT" name="SECTORID" label="Sector" required="yes" width="200" bind="{UsersGrid.dataProvider
[UsersGrid.selectedIndex]['SECTORID']}" onChange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex, 'SECTORID',
SECTORID.text);">
</cfformgroup>
...
North America
Europe, Middle East and Africa
Asia Pacific