Skip navigation
Currently Being Moderated

Value shown in cfgridcolumn but not in cfinput

May 13, 2012 10:21 AM

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>

 

...

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points