function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vanessa BarrosVanessa Barros 

Reload page after insert on the database

hi.

i develop a force.com site with 3 pages and in the end i insert a record on the SF updating a field that i show on the second page.

but..without closing the browser, i click on the link to go to the first page, navegate into the second page and the field is not updated..just only when i click refresh to reload the browser.

 

someone can help me?

tks 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

The cache attribute on the apex:page standard component tells the browser whether to cache the page or not.  For regular VF it defaults to false, but for sites it defaults to true.  There's more information on Sites caching at:

 

http://wiki.developerforce.com/index.php/Force.com_Sites_Best_Practices#Caching.2C_Performance.2C_and_Daily_Limits

 

it sounds like you want to set this explicitly to false.

 

 

All Answers

bob_buzzardbob_buzzard

Do these pages use the same controller instance (e.g. are they a wizard?)

Vanessa BarrosVanessa Barros

different controllers but is like a wizard.

bob_buzzardbob_buzzard

In that case, I'd expect navigation between pages to reload the record from the database. 

 

When the record is saved, do you redirect the user anywhere or do they just stay on the same page? 

Vanessa BarrosVanessa Barros

i explain the process.

on the first page, i show a list of courses where the user select one clicking on a link.

on the second page, i show the session that are available to the course that the user was selected and the available seats for each session (for example 4 seats).

on the last page, the user make the registration and after insert i redirect to a thank you page.

 

but imagine that i want to register again but in the another session, i will go the first and select the same course and finally on the second page, the page is not reloaded - show me  the same available seats (4 seats) but when i do "refresh", my last insert appear ( 3 seats).

bob_buzzardbob_buzzard

How do you go back to the first page?  If you use the browser history, then I guess you may be hitting a cached page.

Vanessa BarrosVanessa Barros

im not using the browser history or clicling on the back button.

I just type the fist page in the browser and enter.

bob_buzzardbob_buzzard

That's very strange - by navigating back to the page that way, a new instance of the controller should be created.  This sounds like browser caching to me.  Have you checked your browser cache settings?

Vanessa BarrosVanessa Barros

do you want the link to see the problem? its  force.com site

bob_buzzardbob_buzzard

Ah - Sites are a little different I think.  Have you specified any cache attributes on the page?

Vanessa BarrosVanessa Barros

no - i dont know what is that

bob_buzzardbob_buzzard

The cache attribute on the apex:page standard component tells the browser whether to cache the page or not.  For regular VF it defaults to false, but for sites it defaults to true.  There's more information on Sites caching at:

 

http://wiki.developerforce.com/index.php/Force.com_Sites_Best_Practices#Caching.2C_Performance.2C_and_Daily_Limits

 

it sounds like you want to set this explicitly to false.

 

 

This was selected as the best answer
Vanessa BarrosVanessa Barros

solved!!! :D