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

show icon on table insert

Guest
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

hi i would like to have a notice on my webpage if a new record gets inserted to a table in my database

ie if a new record is entered a small icon appears on the page, can this be done without having to refresh the page?
TOPICS
Advanced techniques

Views

756

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

correct answers 1 Correct answer

Deleted User
Mar 29, 2007 Mar 29, 2007
ok i found some code to stop the click sound, but when my page refreshes now i get a white page.

i am tring to code if query recordcount = 0 the show background red else show background image, so i am not sure why i am getting a white page?

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="silent_refresh.js"></script>






<CFIF ShowInbox.recordcount GT 0>
<style type="text/css">
<!--
body {
background-image: url(images/icon2....

Votes

Translate

Translate
Contributor ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

You can do it with AJAX, sending a query to the DB every X seconds or minutes and having a variable with the last record ID in the table. If after querying the DB, the record ID is higher, then you have new records inserted.

Regards

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
Guest
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

ok thanks i have never used ajax, do you know where i can find some example code to do what i need

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 ,
Mar 21, 2007 Mar 21, 2007

Copy link to clipboard

Copied

A quick search for Coldfusion Ajax example in google turned up a plethora of choices. This one looked appropriate:

http://www.quackit.com/ajax/ajax_tutorial.cfm

In addition to straight up ajax, there are a number of framewords that make creating ajax calls a little more user friendly. Popular choices on this forum are Adobe's Spry framework and CFAjax.

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
New Here ,
Mar 21, 2007 Mar 21, 2007

Copy link to clipboard

Copied

One thing to keep in mind is that AJAX is useing javascript so if your not good with JS then you may need to read up some before jumping into it.

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
Guest
Mar 21, 2007 Mar 21, 2007

Copy link to clipboard

Copied

ok thanks i have had i look, i understand the coldfusion code but i am not sure about the js file.

do you know the exact code i would need in the js file to do what i need?


many thanks

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
Explorer ,
Mar 21, 2007 Mar 21, 2007

Copy link to clipboard

Copied

There is another option of using SOAP & Dynamic HTML. You have to write a component in VB that will retrive the data from your database and return back. The method in the VB has to be exposed and SOAP WSDL configured. You can use MS SOAP toolkit to built the WSDL for your component if you are not used to it.

In your web page, write javascript that calls a function say every minute. This javascript function has to use MSXML objects and submit a request as SOAP call. You will get the response and based on the response, dynamically manupulate your web page without refreshing.

If you are not familiar with all these write a <IFRAME> with no border in your page and this frame content will refresh every minute to get the content what you want. Really the user will not know you are refreshing the page as the iframe will be small and only a part of your page.

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
Guest
Mar 22, 2007 Mar 22, 2007

Copy link to clipboard

Copied

ok thanks i have tried the iframe way, but when the page refreshes i get a page click sound

so every 60 secs i get a click sound

can i get rid of this?

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
LEGEND ,
Mar 22, 2007 Mar 22, 2007

Copy link to clipboard

Copied

You can do it without AJAX. You have to run some code anyway to insert the record, so put the icon up after the insert.

If you are doing the insert in an iframe or popup, put the icon on your main page inside a div tag and make it invisible. Use inner html to make that tag visible after you run your insert.

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
Guest
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

yy

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
Guest
Mar 29, 2007 Mar 29, 2007

Copy link to clipboard

Copied

LATEST
ok i found some code to stop the click sound, but when my page refreshes now i get a white page.

i am tring to code if query recordcount = 0 the show background red else show background image, so i am not sure why i am getting a white page?

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="silent_refresh.js"></script>






<CFIF ShowInbox.recordcount GT 0>
<style type="text/css">
<!--
body {
background-image: url(images/icon2.gif);
}
-->
</style>
<cfelse>
<style type="text/css">
<!--
body {
background-color: #BB2020;

}
-->
</style>
</CFIF>
</head>

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