Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reloading problem

Status
Not open for further replies.

jarla

Programmer
Jan 2, 2001
34
0
0
FI
Hi!
Once again a difficult(?) problem. I hope that you professionals can help me.
Our company have picture searching site with option to add pictures to "lightbox" for ordering. Site is made without frames so when user clicks the "Add to lightbox" -button below the picture, the whole page reloads and the status of the lightbox change with the new number of added pictures. I´ve made "addtobasket.cfm" which handles the database change and then forward the user back to the page where the browser was before with all search parameters. That´s ok for PC:s, but Macintosh wants to load all pictures again to the browser window. So it make the query again and it takes too much time. PC take all images from cache and the delay is very little.
Our page have three tables; left one includes template which shows lightbox information etc. and right one shows picture search. Top table have some links to the different pages.
So:
Is there any way to update only that left table (that template page) and keep the picture search table untouched? Then I can maybe make all database changes in that template?
We don´t want to use frames, with them it would be easy to reload only one frame...
 
Unfortunately, using ColdFusion, you can't really do this efficiently. For ColdFusion to receive your FORM variables, the browser needs to make a round trip to the server and reload the entire page. More bad news... you can't count on PCs to always cache all the images either. I, for instance, have my browser set up to never cache content. So even though I'm on a PC, my browser would reload all the images again.

But, some good news... when I said "can't really do this efficiently", I didn't mean it's entirely impossible. If you really feel like so hardcore, lengthy and probably rather frustrating development. You'd need to use a combination of ColdFusion and javascript. And the concept would be:
On the user clicking Add to lightbox, use javascript to open a pop-up window that loads a CFM page.
This CFM page in the pop-up will run and do the updates to the database.
Once the updates are completed, the pop-up window then creates a list of images (probably IDs) that should appear in the lightbox and passes this list, using javascripts ability to determine
Code:
window.opener
back to a javascript function on the main page.
The javascript function on the main page receives the list and rebuilds the lightbox using DHTML to hide and show images as appropriate.

Not fun. But could work, in theory.

I think your only other option is, of course, frames (or IFrames, if you can).



-Carl
 
Thanks for help!
Actually only what I need is the number of pictures that are on the lightbox. For example "2 images". I think it´s enough if I can make a JavaScript which receives that #lightbox.recordcount# -value when the page first load and then when user clicks the "Add to lightbox" -button, that value would be "value + 1". The actual "addtobasket" -page loads to the hidden frame now so it takes all needed parameters.
But the worst thing is that I don´t know much about Javascript. The code itself sounds very simple: It have value (x) when page loads and when user clicks the "Add to lightbox" -button, value is then (x + 1).
Am I right that then the value change without page reload??

Any tips for easy JS for that :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top