Skip to main content
Inspiring
May 2, 2011
Question

Selected Items in Drop Down Menu in Dynamic Data Table

  • May 2, 2011
  • 1 reply
  • 1340 views

Hi. I am having a problem getting some initials to be selected in a drop down menu I have when I output dynamic data into a table with a form for updating. This code works in Cold Fusion 9, but not in 7. I have a friend that says it works on his anyway and that's the only difference we see between each other's systems. Does anyone know why this is or what I could do to get this to work correct? Below is what I have. Thank you.

<CFQUERY NAME="ShowInitials" Datasource="#application.DataSource#">
SELECT *
From Users
where Engineer_Initials = yes
Order by Initials
</CFQUERY>


<CFQUERY NAME="PNRBOMSearch" Datasource="#application.DataSource#">
SELECT ECID, Requested_By_Initials, EC_Completion_Initials, EC_Completion_Date, Comments, ItemID, ECID_SPEC, ECO_Start_Date, Date_Requested, Part_Number, Description, P_Drive_Docs, Release_Status, Validation_ItemID, Validation_ECID, Validation_Qty, Open_Jobs_Affected,
    Approval_PNR.APVID as PNR_APVID, Approval_BOM.APVID as BOM_APVID,
    Approval_PNR.Approval_Initials as PNR_Initials, Approval_BOM.Approval_Initials as BOM_Initials

FROM ((((ECO_Master LEFT JOIN ECO_Items ON ECO_Master.ECID = ECO_Items.ECID_SPEC)
LEFT JOIN Validation_Records ON ECO_Items.ItemID = Validation_Records.Validation_ItemID)
LEFT JOIN Approval as Approval_PNR ON (ECO_Items.ItemID = Approval_PNR.APV_ItemID AND Approval_PNR.Document_Type = 'PNR Req'))
LEFT JOIN Approval as Approval_BOM ON (ECO_Items.ItemID = Approval_BOM.APV_ItemID AND Approval_BOM.Document_Type = 'BOM Req'))

WHERE (Requested_By_Initials = '#cookie.UserInitials#' AND EC_Completion_Date Is Null)

ORDER BY ECID DESC, ItemID DESC
</CFQUERY>


<CFOUTPUT>

<cfform name="EditItem" method="post" action="Queue_PNR_BOM_action.cfm">

<cfloop query="PNRBOMSearch">

<td align="center">
<select name="PNR_Approval_Initials#ItemID#">
<option value="">PNR Initials</option>
<cfloop query="ShowInitials">
<option value="#Initials#" <cfif Initials EQ PNRBOMSearch.PNR_Initials>selected</cfif>>#Initials#</option>
</cfloop>
</select>
</td>

</cfloop>

<input type="submit" value="Update"> 
<input type="reset" value="Reset">

<input type="hidden" name="listofids" value="#ValueList(PNRBOMSearch.ItemID)#">

</cfform>

</cfoutput>

Andy

    This topic has been closed for replies.

    1 reply

    Inspiring
    May 2, 2011

    Please be more specific on what actually happens in ColdFusion 7. 

    Inspiring
    May 2, 2011

    On my friend's server 9, the initals are selected in the drop down when the page loads. On our server 7, the initials are not selected and just the first option that says "PNR Initials" is displayed in the drop down when the page loads. So if the initials "AG" are entered into the database already, the initials "AG" should be displayed in the drop down menu when the page opens. We are using the exact same code at my company and my friend's company, but it only works at his place, but not mine and we're not sure why other than the fact that he has Cold Fusion Server 9 and we have Cold Fusion Server 7.

    Andy

    Inspiring
    May 2, 2011

    Are you and your friend selecting from the same database?  Also, on your page, are the initials AG available for selection?