Solved

CFWINDOW changes

Posted on 2012-03-24
3
389 Views
Last Modified: 2012-03-29
On manage_glc.cfm I have a button for Add PID which triggers

function addLink()
{
            ColdFusion.Window.show('addInventory');
}

and then:

<cfwindow name="addInventory" modal="true" resizable="true" title="Add New PID" height="450" destroyonclose="true"
source="add_Inventory.cfm?glc=#form.GLC_ID#">
</cfwindow>

This brings up the window fine, but the add_inventory.cfm should show a record ID instead of 0.

If I call add_inventory.cfm?CFDebug=TRUE&glc=10022, the ID number populates and the form works just fine.

Any ideas on why the ID number is not coming through into the CFWINDOW?

add_inventory.cfm code:

<cfinclude template="validuser.cfm">
<cfinclude template="qry_pid.cfm">

<style type="text/css">
      div.scroll {height:200px;width: 925px;      overflow: auto; }
       .visible {visibility:visible}
      .invisible {visibility:hidden}
</style>

<cfparam name="CallNum" default="0">
<cfparam name="submit" default="">
<cfparam name="cancel" default="">
<cfparam name="isblank" default = "no">
<cfparam name="url.cfgridkey" default="0">
<cfparam name="url.glc" default="">
<cfparam name="variables.error" default="">

<cfparam name="form.modify_sbcuid" default="">
<cfajaximport tags="cfwindow">

<cfoutput>


<cfquery name="getitem" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
SELECT     dbo.GLC_Inventory.ID, dbo.GLC_Inventory.PID_ID, dbo.GLC_Inventory.GLC_ID, dbo.GLC_Inventory.BIN, dbo.GLC_Inventory.MIN, dbo.GLC_Inventory.MAX,
              dbo.PIDS.MOQ, dbo.GLC_Inventory.INVENTORY_Count, dbo.GLC_Inventory.INVENTORY_DATE, dbo.GLC_Inventory.Modify_Date, dbo.GLC_Inventory.Modify,
              dbo.GLC_Inventory.ACTIVE_STATUS, dbo.PIDS.DESCRIPTION, dbo.PIDS.COST, dbo.PIDS.UNIT
FROM         dbo.PIDS INNER JOIN
                      dbo.GLC_Inventory ON dbo.PIDS.PID_ID = dbo.GLC_Inventory.PID_ID
WHERE dbo.GLC_Inventory.ID = '#callnum#'
</cfquery>





<!--- begin of when record is submitted --->
<cfif  cancel is "cancel" and Form.submitcall is "cancel">
      <script>
    ColdFusion.Window.close('addInventory');
    </script>
</cfif>

<cfif isDefined("form.submit")>

      <cfquery name="getitem" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
SELECT     dbo.GLC_Inventory.ID, dbo.GLC_Inventory.PID_ID, dbo.GLC_Inventory.GLC_ID, dbo.GLC_Inventory.BIN, dbo.GLC_Inventory.MIN, dbo.GLC_Inventory.MAX,
              dbo.PIDS.MOQ, dbo.GLC_Inventory.INVENTORY_Count, dbo.GLC_Inventory.INVENTORY_DATE, dbo.GLC_Inventory.Modify_Date, dbo.GLC_Inventory.Modify,
              dbo.GLC_Inventory.ACTIVE_STATUS, dbo.PIDS.DESCRIPTION, dbo.PIDS.COST, dbo.PIDS.UNIT
FROM         dbo.PIDS INNER JOIN
                      dbo.GLC_Inventory ON dbo.PIDS.PID_ID = dbo.GLC_Inventory.PID_ID
WHERE dbo.GLC_Inventory.ID = '#callnum#'
      </cfquery>
      
      <cfset isblank = "no">
      
      <cfif getitem.recordcount is 0>
            <cfquery name="getitem" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
            SELECT     dbo.GLC_Inventory.ID, dbo.GLC_Inventory.PID_ID, dbo.GLC_Inventory.GLC_ID, dbo.GLC_Inventory.BIN, dbo.GLC_Inventory.MIN, dbo.GLC_Inventory.MAX,
              dbo.PIDS.MOQ, dbo.GLC_Inventory.INVENTORY_Count, dbo.GLC_Inventory.INVENTORY_DATE, dbo.GLC_Inventory.Modify_Date, dbo.GLC_Inventory.Modify,
              dbo.GLC_Inventory.ACTIVE_STATUS, dbo.PIDS.DESCRIPTION, dbo.PIDS.COST, dbo.PIDS.UNIT
FROM         dbo.PIDS INNER JOIN
                      dbo.GLC_Inventory ON dbo.PIDS.PID_ID = dbo.GLC_Inventory.PID_ID
WHERE dbo.GLC_Inventory.ID = '#callnum#'
            </cfquery>
                        
            <cfset isblank = "yes">
      </cfif>
      
<!---      debug<br />

<script>
alert('before submitcall!');
</script>

<cfoutput>
GLC_ID = '#form.glc_id#',PID_ID = '#Form.pid_id#', BIN ='#Form.bin#', MIN ='#Form.min#', MAX ='#Form.max#', INVENTORY_Count='#Form.INVENTORY_Count#'
</cfoutput>

--->

 <cfquery name="submitCall" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
            UPDATE            GLC_Inventory
                  SET
                        GLC_ID = '#form.glc_id#',
                        PID_ID = '#Form.pid_id#',
                BIN ='#Form.bin#',
                MIN ='#Form.min#',
                MAX ='#Form.max#',
                INVENTORY_Count='#Form.INVENTORY_Count#',
                Active_Status = 1,
                INVENTORY_DATE = '#dateformat(CreateODBCDateTime( Now()), "mm/dd/yyyy")#',
                Modify = '#getcurruser.uid#',
                Modify_date = '#dateformat(CreateODBCDateTime( Now()), "mm/dd/yyyy")#'
               
                  WHERE ID = '#callnum#'
      </cfquery>
      
      <table width="920" border="0" cellspacing="0" cellpadding="0">
<tr>
      <td class="heading" align="center" colspan="1">Inventory Record Submission Status</td>
<tr>
      <td align="center" colspan="1">The record has been submitted.</td>
</tr>


<tr>
      <td align="center"><a href="add_inventory.cfm?cfgridkey=#Callnum#" class="vc" >Back to record ###callnum#</a></td>
</tr>      
<tr>
      <td align="center"><a href="add_inventory.cfm" class="vc" >Enter Another Item</a></td>
</tr>
            <tr>
      <td align="center"><a href="manage_glc.cfm" class="vc" >Back to Manage GLC</a></td>
</tr>      
            </table>
   
       
       
            <br><br>
<cfelse>
<!--- start form --->
<html>
<head>

<script>

 // no scripts needed
   
</script>
</head>

<body>


<iframe name="ifrHidden" width="100%" height="1" style="display: none;"></iframe>

<cfform action="add_inventory.cfm?cfdebug=true" method="post" name="AddInventory" id="AddInventory" onSubmit="return submitForm();" >
      
      <input type="hidden" name="callNum" value="#callnum#">
      
   
      <span id="errorBox"></span>
      
<table width="450" border="1"  cellpadding="1" cellspacing="1">
            <tr align="center">            
                        <td colspan="9" class="heading">Inventory Record Details</td>
            
  <tr>

  <tr>
                  <td width="10%" align="right" class="InputLabel">ID: </td>
                  <td width="20%" valign="middle" class="formElement"><input type="text" name="call_id"  size="10" value="#callnum#" readonly></td>
  </tr>
 
                    
  <tr>
                  <td width="10%" align="right" class="InputLabel">GLC ID: </td>
                  <td width="20%" valign="middle" class="formElement"><input type="text" name="glc_id"  size="10" value="#url.glc#" readonly></td>
  </tr>
 
      
      <!---- if a call is existing and number is passed through cfgridkey --->
      <cfif url.cfgridkey neq 0>
            <cfquery name="getitem" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
                        SELECT     dbo.GLC_Inventory.ID, dbo.GLC_Inventory.PID_ID, dbo.GLC_Inventory.GLC_ID, dbo.GLC_Inventory.BIN, dbo.GLC_Inventory.MIN, dbo.GLC_Inventory.MAX,
              dbo.PIDS.MOQ, dbo.GLC_Inventory.INVENTORY_Count, dbo.GLC_Inventory.INVENTORY_DATE, dbo.GLC_Inventory.Modify_Date, dbo.GLC_Inventory.Modify,
              dbo.GLC_Inventory.ACTIVE_STATUS, dbo.PIDS.DESCRIPTION, dbo.PIDS.COST, dbo.PIDS.UNIT
FROM         dbo.PIDS INNER JOIN
                      dbo.GLC_Inventory ON dbo.PIDS.PID_ID = dbo.GLC_Inventory.PID_ID
WHERE dbo.GLC_Inventory.ID = '#url.cfgridkey#'                        
            </cfquery>
            
            <cfif getitem.recordcount is 0>
                  <cfquery name="getitem" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
                  SELECT     dbo.GLC_Inventory.ID, dbo.GLC_Inventory.PID_ID, dbo.GLC_Inventory.GLC_ID, dbo.GLC_Inventory.BIN, dbo.GLC_Inventory.MIN, dbo.GLC_Inventory.MAX,
              dbo.PIDS.MOQ, dbo.GLC_Inventory.INVENTORY_Count, dbo.GLC_Inventory.INVENTORY_DATE, dbo.GLC_Inventory.Modify_Date, dbo.GLC_Inventory.Modify,
              dbo.GLC_Inventory.ACTIVE_STATUS, dbo.PIDS.DESCRIPTION, dbo.PIDS.COST, dbo.PIDS.UNIT
FROM         dbo.PIDS INNER JOIN
                      dbo.GLC_Inventory ON dbo.PIDS.PID_ID = dbo.GLC_Inventory.PID_ID
WHERE dbo.GLC_Inventory.ID = '#url.cfgridkey#'
                  </cfquery>
                  <cfset isreview="no">
            </cfif>

            <script>
                  //set the callID and call_id fields with the project id
                  document.AddInventory.call_id.value = '#url.cfgridkey#';
                  document.AddInventory.callNum.value='#url.cfgridkey#';
            </script>
      <cfelse>
      <!--- check to see if user already has a blank , shouldn't, but cleans it up again--->
            <cfquery name="doesUserHaveBlank" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
            SELECT                   TOP 1 ID
                  FROM                   dbo.GLC_Inventory
                  WHERE                   GLC_ID = '0' and modify like '#getCurrUser.uid#'            
                  </cfquery>
            
            <!--- if there are no blanks, insert a new record as placeholder --->
              <cfif doesUserHaveBlank.recordcount is 0>
                  <cfquery name="insertBlankCall" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
                  INSERT INTO GLC_Inventory
                        (
                             GLC_ID,
                        Modify,
                        Modify_date
                  )
                   VALUES
                        (
                    0,
                    '#getcurruser.uid#',
                    '#dateformat(CreateODBCDateTime( Now()), "mm/dd/yyyy")#'
                        )
                  </cfquery>
                  <!--- retrieve the record just created --->
                  <cfquery name="getBlankCallNbr" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
                  SELECT             ID
                  FROM             dbo.GLC_Inventory
                  WHERE             GLC_ID = '0' and modify like '#getCurrUser.sbcuid#'      
                  </cfquery>

                  <script>
                        //set the callnum and call_id fields with the call id
                        document.AddInventory.call_id.value = '#getBlankCallNbr.ID#';
                        document.AddInventory.callNum.value ='#getBlankCallNbr.ID#';
                  </script>
            <cfelse>
                  <script>
                        //set the callnum and call_id fields with the call id
                        document.AddInventory.call_id.value = '#doesUserHaveBlank.ID#';
                        document.AddInventory.callNum.value = '#doesUserHaveBlank.ID#';
                  </script>
            </cfif>
      </cfif>
      
                      

                              
                  
             
            <tr>
             <td width="10%" align="right" class="InputLabel"><span class="req">*</span>PID</td>
            <td width="20%" valign="middle" class="formElement">
            <cfoutput>
       <select name="pid_id"  style="width:350px;" onmouseover="window.status='Select PID';return true"
        onmouseout="window.status='Done';return true">
                        
                <option value=0 selected>Select a PID</option>
                              <cfloop query="qry_PID">
                                    <cfif qry_PID.pid_id is #getitem.pid_ID#>
                                          <option value="#qry_PID.PID_ID#" selected>#qry_PID.PID_ID# - #qry_PID.DESCRIPTION#</option>
                                    <cfelse>
                                          <option value="#qry_PID.PID_ID#">#qry_PID.PID_ID# - #qry_PID.DESCRIPTION#</option>
                                    </cfif>
                              </cfloop>
                  </select>
            </cfoutput>
            </td>
            </tr>
           
            <tr>
            <td width="10%" align="right" class="InputLabel"><span class="req">*</span>Bin</td>
            <td width="20%"><input type="text" name="bin" value="#getitem.bin#">
            </td>
            </tr>
       
        <tr>
            <td width="10%" align="right" class="InputLabel"><span class="req">*</span>Min</td>
            <td width="20%"><input type="text" name="min" value="#getitem.min#">
            </td>
            </tr>
           
            <tr>
            <td width="10%" align="right" class="InputLabel"><span class="req">*</span>Max</td>
            <td width="20%"><input type="text" name="max" value="#getitem.max#">
            </td>
            </tr>      
           
            <tr>
            <td width="10%" align="right" class="InputLabel">Inventory Count</td>
            <td width="20%"><input type="text" name="INVENTORY_Count" value="#getitem.INVENTORY_Count#">
            </td>
            </tr>
           
            
            <tr>
                  <td width="10%" valign="middle" align="center" colspan="2">
                        <br>
                        <input type="hidden" name="submitCall" value="">
                        
                <input type="submit" name="Submit" value="submit" onClick="document.AddInventory.submitCall.value = 'submit';">
                        <input type="reset" name="Clear" value="Cancel" onClick="ColdFusion.Window.hide('addInventory')">
                        <input type="hidden" name="Error" value="#Error#">      
                        <input type="hidden" name="cfgridkey" value="#cfgridKey#">
                        

                        &nbsp;&nbsp;&nbsp;<br>
                  </td>
            </tr>            
      </table>
            
</cfform>
</html>



</cfif>
0
Comment
Question by:bhinshawnc1
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 37761446
Your CFWINDOW is created when this tag is run...

<cfwindow name="addInventory" modal="true" resizable="true" title="Add New PID" height="450" destroyonclose="true"
source="add_Inventory.cfm?glc=#form.GLC_ID#">
</cfwindow>



Therefore, your initial cfwindow will use glc = form.glc_id when the page initial loads.

If you want to change the content of that window at any time based on user actions, you need to use ColdFusion.navigate('add_Inventory.cfm?glc='+theID,'winName')


So you can chagne this function..

function addLink()
{
            ColdFusion.Window.show('addInventory');
}



to include passing the ID...


function addLink(theID)   {
   ColdFusion.navigate('add_Inventory.cfm?glc='+theID,'addInventory')
   ColdFusion.Window.show('addInventory');
}
0
 
LVL 3

Author Comment

by:bhinshawnc1
ID: 37761516
I need to clarify where things are going wrong

If I test add_inventory.cfm?CFDebug=TRUE&glc=10022 outside the cfwindow i get a screen that looks like:

ID: 698304
GLC: 10022
PID: select list
etc

When I run it through cfwindow from manage_glc it displays:

ID: 0
GLC:10022
PID: select list
0
 
LVL 3

Author Closing Comment

by:bhinshawnc1
ID: 37784293
Thanks for assistance
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question