Skip to main content
Inspiring
August 27, 2009
Question

Coldfusion.Navigate loading cached info into cfdiv

  • August 27, 2009
  • 2 replies
  • 3052 views

I have a cfdiv binded to a cfc or url (same issue with both scenarios).  its a basic list with a link to open a cfwindow with a form to edit the details of the record.  When your done editting the record, you press a submit button which does a Coldfusion.Ajax.Submit form and runs an update script.  On the callback of the update script, I have it close the cfwindow and then do a Coldfusion.navigate back to the cfc or URL to refresh the main cfdiv...

For some strange reason, the cfdiv keeps showing the same info.  If I refresh the entire page I get the updated info.  Tried on multiple browsers.

Any ideas?  I'm gathering its either cached info, or its refreshing to fast.  I put the update script in the callback of the submit form thinking the refresh wouldnt trigger until the update is ran...

any thoughts would be appreciated...

I've done a number of applications where I've never seen this issue... and then all of a sudden a few apps have... and its basically the same code on all the apps.

main page:

<script>
function addItem(bondid) {
  ColdFusion.navigate('_activityform.cfm?bondid='+bondid,'activityWindow');
  ColdFusion.Window.show('activityWindow');
}
function editItem(bondid, bond_activityid) {
  ColdFusion.navigate('_activityForm.cfm?bondid='+bondid+'&bond_activityid='+bond_activityid,'activityWindow');
  ColdFusion.Window.show('activityWindow');
}

function activitySubmit(bondid) {
// ColdFusion.Ajax.submitForm('activityForm','_activitySubmit.cfm');
ColdFusion.Ajax.submitForm('activityForm','_activitySubmit.cfm', closeActivityWindow(bondid));
}

function closeActivityWindow(bondid) {
ColdFusion.Window.hide('activityWindow',1);
ColdFusion.navigate('/cfc/bond.cfc?method=getBondActivityTable&returnFormat=plain&bondid='+bondid,'activityDiv');
}
</script>

<cfwindow center="true" closable="true" draggable="true" modal="true" resizable="false" initshow="false" refreshonshow="false" height="400" name="activityWindow" title="Activity Window" width="650"></cfwindow>

<cfdiv id="activityDiv" bind="cfc:cfc.bond.getBondActivityTable('#bondid#')">

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
September 11, 2009

Shouldn't it be

<cfdiv id="activityDiv" bind="cfc:cfc.bond.getBondActivityTable({bondid})">?

ifsteveAuthor
Inspiring
September 11, 2009

Thanks for the replies.

I've been testing it firefox and everything executes ok. No errors of any kind.

The cfdiv initially binds to a URL variable (bindid) and then gets refreshed through the Coldfusion.Navigate. Its an intermittent problem. Sometimes 10 out of 10 times it refreshes with fresh data, and sometimes its 6 out of 10 with fresh and 4 cached records. When verifying against the DB the record has updated properly. Until I have the time to figure it out, I added a button to the page to manual refresh it with a Coldfusion.Navigate and it comes up ok.

BKBK
Community Expert
Community Expert
September 12, 2009
testing it firefox and everything executes ok.  No errors of any kind.

No surprises there.

The cfdiv initially binds to a URL variable (bindid) and then gets
refreshed through the Coldfusion.Navigate.  Its an intermittent
problem.  Sometimes 10 out of 10 times it refreshes with fresh data,
and sometimes its 6 out of 10 with fresh and 4 cached records.  When
verifying against the DB the record has updated properly.

Hang on a minute. The cfdiv binds with a CFC, not with a URL. So you shouldn't expect any refresh of the content of the cfdiv! Even if you pass a URL variable, the bind implies an action to be performed in the CFC. It's a bonus if you then get refreshed content.

One way to at once call the CFC and refresh the cfdiv is to put the code to invoke the CFC in a separate CFM page. Then bind the cfdiv to that CFM page, passing  the URL variable in the bind.

September 11, 2009

function activitySubmit(bondid) {
ColdFusion.Ajax.submitForm('activityForm','_activitySubmit.cfm', closeActivityWindow(bondid));
}

Do you get any Javascript errors? From what I recall from the documentation, the callback function returns the response body of the HTTP request so I'm not sure that passing the bondID into that function is actually working. If you aren't getting a Javascript error, I'm wondering if it's appending the full response body to the URL in your callback function instead of the bondID that you think is being passed. Just a thought.