LiveCycle Forms7: how to disable client-side caching

Issue

 If you are using FormServer 7.1 you may want to disable client-side caching.  This will prevent previously entered values from appearing on a new form when you open it in a fresh browser instance.

Reason

The problem is that Acrobat/Reader is caching the form (along with its data). It does this based on the URL address (same URL = same form/data). Unfortunately, since this is a client setting there is no easy way to disable it.

Solution

Here are some suggestions to achieve this:

1) on the form (i.e. will be on a form by form basis):

add this code into the form:ready event -

var oDoc = event.target; 

oDoc.nocache = true;

2) make the URL unique:

An easy way of doing this is to return a date/time stamp as an unused parameter in the URL. This can be easily added by either the JSP or the servlet. For example:

http://localhost:8080/MyApp/MyServlet?date=2034832808198

3)  Also consider setting the cache control headers in your response:

// Set content to expire far in the past. 
response.setHeader("Expires", "Thu, 1 Jan 1970 12:00:00 GMT"); 

// Set standard HTTP/1.1 no-cache headers. 
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); 

// Set special IE extended HTTP/1.1 no-cache headers (use addHeader). 
response.addHeader("Cache-Control", "post-check=0, pre-check=0"); 

// Set standard HTTP/1.0 no-cache header. 
response.setHeader("Pragma", "no-cache");

____________________________________________

reference: (1-28022235)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 0.0/10 (0 votes cast)

Comments are closed.