Link to home
Start Free TrialLog in
Avatar of henderxe
henderxe

asked on

Attribute validation error for tag CFSelect.

All of a sudden (hadn't previously), I started getting the following error:

-------------------------------  START ERROR -----------------------------------------------
Exception
Message       Attribute validation error for tag CFSelect.
Detail       The value of the attribute Query, which is currently application.getMailingList, is invalid.
Extended Info       
Tag Context       R:\aihtc\ART_TEST\views\cfm\exportReports\idListGeneration\contactDetailsDisp.cfm (73)
R:\aihtc\ART_TEST\views\cfm\exportReports\idListGeneration\idListGeneration.cfm (45)
R:\aihtc\ART_TEST\views\cfm\exportReports\exportReports.cfm (203)
C:\inetpub\wwwroot\MachII\framework\ViewContext.cfc (107)
C:\inetpub\wwwroot\MachII\framework\EventContext.cfc (468)
C:\inetpub\wwwroot\MachII\framework\commands\ViewPageCommand.cfc (85)
C:\inetpub\wwwroot\MachII\framework\EventHandler.cfc (81)
C:\inetpub\wwwroot\MachII\framework\RequestHandler.cfc (379)
C:\inetpub\wwwroot\MachII\framework\RequestHandler.cfc (327)
C:\inetpub\wwwroot\MachII\framework\RequestHandler.cfc (271)
C:\inetpub\wwwroot\MachII\framework\RequestHandler.cfc (201)
C:\inetpub\wwwroot\MachII\mach-ii.cfm (123)
R:\aihtc\ART_TEST\index.cfm (9)
------------------------------------------ END ERROR ----------------------------------------------

Here's the form field layout:

----------------------------------------- START FORM ----------------------------------------------
<fieldset  id="countDetailsStep5" style="height:auto; width:auto; display:none; "> 
        <legend>Step 5:  Mail List</legend>
        <cfoutput>
        <div class="mailList">
            <div style="width:65%; float:left; border:0px solid red;">  
               <cfform name="explist">
               <span class="checkBoxLabel">Include Mailing List:</span>                  
                               
                <cfselect id="includeMailingList"  name="includeMailingList[]"  multiple="yes" size="1"
                    query="application.getMailingList"
                    value="code"  
                    display="description"
                    bindonload="true"
                    editable="yes"
                    class="selectStyle" style="width:auto;"/>                                            
                <input type="hidden" id="includeMailingList_hdn" name="includeMailingList_hdn"   />                          
               </cfform>
            </div>
            <div style="width:18%; float:right">                      
                <input type="button"  class="buttonStyle" value="Generate List" onclick="showStep4(#queryID#,'IsListIncludeSpouseID','Yes','#fromReport#')"><br />
            </div>
        </div>
        </cfoutput>
     </fieldset>
------------------------------------------  END FORM ---------------------------------------------

   And here's the query the form points to:

------------------------------------- START QUERY ----------------------------------------------
<cfif NOT IsDefined("APPLICATION.getMailingList")>
              <cfquery name="APPLICATION.getMailingList"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#">
                        select mail_list_code_code code, mail_list_code_code||' - '||short_desc description, short_desc,mail_list_group_code
                    from tms_mail_list_code
                    where status_code = 'A'
                    order by short_desc
                </cfquery>    
        </cfif>
------------------------------------------- END QUERY -----------------------------------------------

I did some research which suggested that there's a known problem with the CFSELECT tag.

Incidently, it doesn't matter if I replace the entire application (folder) with backups, even from last year (2010), I still get the same error.

Any ideas on how to fix this?

Thanks!

   
Avatar of Brijesh Chauhan
Brijesh Chauhan
Flag of India image

Any reason to name the query as APPLICATION. ? it might be probably looking for a APPLICATION scope variable rather than the query, just as a test, just have the query above the cfselect, name the query without the APPLICATION. and check if it works...

    <cfquery name="getMailingList"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#">
                        select mail_list_code_code code, mail_list_code_code||' - '||short_desc description, short_desc,mail_list_group_code
                    from tms_mail_list_code
                    where status_code = 'A' 
                    order by short_desc
                </cfquery>

Open in new window

Avatar of gdemaria
It's very interesting having a query in the application scope.  The entire application for all users use this same query?

I am wondering where this code... is located in your files?   It seems it would have to be in your applicaton.cfc/.cfm file.  Is that where it is?   Either that or it would be in the same file as the form..  ?

<cfif NOT IsDefined("APPLICATION.getMailingList")>
              <cfquery name="APPLICATION.getMailingList"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#">
                        select mail_list_code_code code, mail_list_code_code||' - '||short_desc description, short_desc,mail_list_group_code
                    from tms_mail_list_code
                    where status_code = 'A'
                    order by short_desc
                </cfquery>    
        </cfif>

Avatar of henderxe
henderxe

ASKER

Yes, the APPLICATIONS scope is used to load "multiselect" drop down menus throughout the application, primarily because some of them are rather large (e.g. geographic areas, degrees, etc).   Loads much faster for users.

Were running the MACH-II framework with Coldfusion, and upload the data into the APPLICATIONS scope via a scheduled "event".   The query I posted in my initial post is one of may queries in that file (getAppScopeDataDAO.cfc).   Process is initiated by the following event:

--------------------------------------  BEGIN EVENT --------------------------------------------------
<cfcomponent extends="MachII.framework.Listener" displayname="scheduledTasks" hint="scheduledTasks" output="false">

      <cfset basePath = "#GetDirectoryFromPath(replace(expandPath("./"), "\","/","ALL"))#">
       <cfset baseFolder =   "#GetFileFromPath(left(basePath,len(basePath)-1))#">
      <cffunction name="configure" access="public" returntype="void" output="false">      
                <cfset db = StructNew() />
                  <cfset  dbName = getProperty("dbName")>  <!--- getting dbname from machii.xml  --->
             <cfset dbUserName = getProperty("dbUserName")>
             <cfset  dbPassword = getProperty("dbPassword")>
            <cfset  variables.appScopeDataObject = createObject("component","#baseFolder#.model.scheduled.getAppScopeDataDAO").init(dbName, dbUserName,dbPassword)/>
      </cffunction>
   
      <cffunction name="getNewQueryAppScopeData" access="public" returntype="void">
             <cfset success = variables.appScopeDataObject.newQueryAppScopeData() />
          <cfset getLog().info("Data has been loaded into Application Scope. Result=#success#") />
      </cffunction>
</cfcomponent>
-------------------------------------------------END EVENT ----------------------------------------------------

  It has always worked fine (since July 2010).   For some unknown reason (although could be due to changes made elsewhere in the program), it stopped working for the first time today.
Is the failure happening when you first load the page, or after a while..

I am wondering if the application scope is timing out, the function has to rerun when the application times out

It appears to fail almost "instantly".  The application itself loads normally, but when I click on ANY of the options, it immediately generates the error.

By the way, I did try removing the "application" preceding the query name (e.g. getMailingList), but get the same error.
>  I did try removing the "application" preceding the query name (e.g. getMailingList), but get the same error.

It wouldn't help to remove this unless you placed the query in the same file as the CFSELECT


You should try to ensure that that part of the code is running, the part that creates the CFQUERY

I am guessing that it is defined in this function?   Try adding a flag inside with an abort, this will tell you (1) that you are getting to the right spot and (2) whether or not the variable is being set..


<cffunction name="getNewQueryAppScopeData" access="public" returntype="void">
   <cfset success = variables.appScopeDataObject.newQueryAppScopeData() />

    <cfif IsDefined("APPLICATION.getMailingList")><h1>APP DEFINED</h1>
    <cfelse><h1>APP NOT DEFINED</h1>
    </cfif> <cfabort>


   <cfset getLog().info("Data has been loaded into Application Scope. Result=#success#") />
</cffunction>

ASKER CERTIFIED SOLUTION
Avatar of Brijesh Chauhan
Brijesh Chauhan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Problem solved -- but solution unbelievable!

I noticed on the server that 21GB (of 24GB) of RAM was being used.  Normally, only about 5GB of RAM is used leaving approximately 19GB "available".

So . . . I rebooted the server, and the problem went away.   Wish I had thought of it earlier - makes a lot of sense since the query was dependent on information in memory (APPLICATION scope), which wasn't there.

   But I'm very appreciative of not only the rapid response by you both, but also helping me in starting the process of analyzing possible solutions, as well as my getting a better understanding of the problem.

    Thanks again!