2 replies [Last post]
ms_shubha
Offline
newbie
Last seen: 13 years 20 weeks ago
Joined: 2009-02-11
Posts: 3
Points: 0

I am new to java programming and this question is related to checkbox.
Here is the scenario:
1. I am in page A and it has few links with checkboxes.
2. I select few check boxes.
3. Proceed to next page.
4. Come back to previous page,the checked boxes are unchecked.
How to fix this problem?

Tags:
Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 25 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Does this question relate to

Does this question relate to CSS?

You really need a scripting forum for this sort of question.

Moving to 'Off Topic'

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 10 years 36 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Quote:I am new to java

Quote:

I am new to java programming

Java? Or Javascript? Manipulating web pages, sounds like Javascript (different language)

Quote:

Come back to previous page,the checked boxes are unchecked.

Are you coming back to previous page via the Back button, or a Javascript button?

If it's Via the Back button (the way everyone in the world does it and more, pls stay away frm JS'd "back" buttons, they're evil) then two things are happening:

Either you've (or someone) turned browser caching off. Check to see if it's on.

or

Checkboxes sound like a form. Forms which send information (instead of forms which do searches and bring back search results via GET) are normally POST as their sending-to-server method. Using POST requires that your HTTP Headers are set to no-cache, no-store. What this does is make FireFox ask you something about resending information, while IE just dies (er, only after the user has hit SUBMIT, and then the Back button).
If you have a POST form without the no-cache, no-store you might still have the browser thinking it shouldn't cache (because it shouldn't)-- if the user has hit SUBMIT. There are two ways to "fix" this:

One, use a "persistant session" (google it, I dunno nothin about them) to track the user and temporarily hold the user's info in memory until their session ends--so when they hit Back, it's the server remembering what they've filled in, not the browser.
Two, with real submitting-stuff forms, there's a method called POST-request-GET (I think, I forget), where the POST sends the user info to the server, which then has an add-on script with a GET request for the page (or the previous page, I forget). So long as there's a GET request later, the browser can "see" its history, and go back... I'm not 100% sure if this will also still remember what was filled in before SUBMIT though.

I'm thinking if these are filled in and you're NOT hitting SUBMIT then it's pure browser caching. Use a session.

I'm no expert, but I fake one on teh Internets