Skip to main content
Participating Frequently
March 23, 2010
Question

Can I use ajaxOnLoad with a function to which I give a parameter?

  • March 23, 2010
  • 1 reply
  • 1054 views

I accidentaly posted this on the live docs... So here I go again:

Can I use ajaxOnLoad with a function to which I give a parameter? 
e.g.: 
<cfset ajaxOnLoad("initCourses('#tmpUUID#')") /> 
  
The JS function looks as following: 
initCourses=function(tmpUUID){ 
     ColdFusion.Layout.collapseAccordion('awCourseList','awCourseList_1_'+tmpUUID); 

     // the _1_ in the name is set through the currentRow attribute while looping through a query
     setWinUnsaved; 

  
I'm having the problem, that my first accordion panel doesn't initialize hidden, so I wrote this method. Later on I noticed, that the accordions were somehow cached, so the URL params given whithin the source weren't right anymore. This might be, because I gave name attributes to the layoutareas. I added an UUID to the name attribute so the source wasn't cached anymore. But now it doesn't seem to find the cflayout container anymore. (I checked the name of the layoutarea and the temporary saved uuid, they are the same.) 
  
I tried using cfhtmlhead instead, but that didn't seem to work neither.

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    March 23, 2010

    So I've been searching the whole day yesterday and many hours today and this is what I got:

    <cfsavecontent variable="jsheadcont">

         <script type="text/javascript">

         <!--

              initCourses('#tmpUUID#');

         //-->

         </script>

    </cfsavecontent>

    <cfhtmlhead text="#jsheadcont#">

    And that's what my JavaScript function looks like:

    initCourses=function(tmpUUID){

         setTimeout("ColdFusion.Layout.collapseAccordion('awCourseList','awCourseList_1_"+tmpUUID+"')",1);

         setWinUnsaved;

    }

    So I'll have to write all that instead of a simple

    <cfset ajaxOnLoad("initCourses('#tmpUUID#')") /> ?

    Or am I completely wrong? I forgot to mention that the accordion is inside a tab-layout which is inside a border-layout.

    Cheers

    Boris