• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfdiv refresh

Community Beginner ,
Jul 08, 2009 Jul 08, 2009

Copy link to clipboard

Copied

I have a page where there is dynamic text and a form. I want to refresh the section containing the dynamic text. I dont want the form section to refresh.

Initially the page displays OK but on refresh anything after cfdiv is dupllicated on the screen. any ideas?

refesh_test.cfm:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function refreshdata() {
ColdFusion.navigate('refresh_test.cfm','testdiv');
}
</script>
</head>

<body onload="window.setInterval('refreshdata()',5000)">

<cfdiv id="testdiv">
<p>sample text here to be refreshed....</p>
</cfdiv>

<p>this form is not to be refreshed...</p>
<form action="post.cfm" method="post" name="test">
<input name="test_field" type="text" />
<input name="submit" type="submit" />
</form>

</body>
</html>

TOPICS
Advanced techniques

Views

3.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 08, 2009 Jul 08, 2009

Copy link to clipboard

Copied

iframe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 29, 2011 Nov 29, 2011

Copy link to clipboard

Copied

Did you ever figure out how to do this?  I want to do the same thing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 02, 2011 Dec 02, 2011

Copy link to clipboard

Copied

LATEST

Think about what you're doing when you're calling the ColdFusion.navigate() function - you're telling CF that you want to load in the contents of the target page (refresh_test.cfm) into your ajax-enabled DIV.  Now take a closer look at the contents of your refresh_test.cfm page - notice how the page contains not only the contents of your DIV, but ALL the page content (including the <form> section that you don't want to refresh).

If you remove the content of your "refreshable" div to a separate CFM file, you can use the method you have outlined here to load that content in via CF's AJAX functionality without bringing in any of the additional content on your page.

e.g.

1) Put code to be refreshed in a separate CFM

2) On your layout page include the code inside your <cfdiv> using <cfimport>

3) Use the ColdFusion.navigate function to refresh that <cfdiv>

That should get you to where you need to go. 

Hope that helps!

- Michael

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation