Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Stop browser from remembering checkbox selections

Reply
Thread Tools

Stop browser from remembering checkbox selections

 
 
Laser Lips
Guest
Posts: n/a
 
      02-22-2010
Hello. First time posting in alt.html.

Does anyone know of a way to stop a browser from remembering checkbox
selections when you refresh the page? Either by JS Code or HTML.

Thanks
Graham
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-22-2010
Laser Lips wrote:

> Does anyone know of a way to stop a browser from remembering checkbox
> selections when you refresh the page? Either by JS Code or HTML.


You could use the nonstandard attribute autocomplete="off" in the <input>
tag, but it's something undocumented and unreliable; specifically, it does
the job on Firefox 3.5 but not on IE 8, for example. And perhaps mostly by
accident, as a side effect of the way it was implemented in some browsers;
its design goal was to affect autofilling of text input boxes.

Using JavaScript, you could reset the form when the page is loaded (and
refresh is counted as a load):

<body onload="document.getElementById('yourform').reset( )">

where 'yourform' is the id of your form (<form id="yourform" ...>).

This implies that when a user accidentally hits Reload after spending half
an our in entering his huge product order that would make you earn a lot, he
wipes away all of the input, unrecoverably, as if he had hit the infamous
destruction button (commonly mislabeled as "Reset" or "Clear").

So if you wish to do something less risky, you might use code that just
clears a particular checkbox, for example, e.g.

<body onload="document.getElementById('foobar').checked = false">

where 'foobar' is the id of your checkbox (<input type="checkbox"
id="foobar" ...>).

--
Yucca, http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
 
Laser Lips
Guest
Posts: n/a
 
      02-23-2010
Thanks for your responce Yucca.

I'm dissapointed that the browser providers have not come up with
something stable.

autocomplete="off" does not work for me.

Using JS is probably not an option because I'm using a technology
called CACHE ( not to be confused with the subject of this post )
CACHE is developed by Intersystems.

When using .csp ( as apposed to php or asp ) files, you can 'bind' a
form to a table in the CACHE database and the form auto populates,
however, sometimes the browser is overriding the checkboxes.

<script>
var browsers=GetAllBrowsers();
browser.stopTryingToBeClever();
</script>

Oh if only.
Graham
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-23-2010
Laser Lips wrote:

> Using JS is probably not an option because I'm using a technology
> called CACHE ( not to be confused with the subject of this post )
> CACHE is developed by Intersystems.


I don't see why that specific server-side technology would prevent the use
of client-side JavaScript. When a browser has got a page, it will be
processed by the browser independently of the server-side code that was run
to generate the page.

Restrictions are possible if the server-side technology munges code that
you, as an author, might write. It can be really annoying. But I don't see
any particular reason why CACHE would do that. Judging from the
documentation snippet
http://vista.intersystems.com/csp/do...sed#GCSP_C9141
CACHE has tools for making client-side JavaScript programming a bit easier,
not harder.

As usual, it is a good idea to test with a trivial Hello world program, i.e.
with a page containing nothing of interest but

<script type="text/javascript">
alert('Hello world')
</script>

in a proper place. If you can do that, you can most probably do a lot more.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
processing mutiple checkbox selections in vbscript .Net Sports ASP General 4 09-29-2009 05:50 PM
How to persist checkbox selections across recordset pages Parag Gaikwad ASP General 18 07-26-2007 04:10 PM
Checking selections made in a checkbox list Menelty Javascript 2 06-11-2004 09:12 PM
Runtime Datagrids and checkbox selections DJ Dev ASP .Net 1 02-10-2004 04:16 AM
Runtime Datagrids and checkbox selections DJ Dev ASP .Net Datagrid Control 1 02-10-2004 04:16 AM



Advertisments