Stop browser from remembering checkbox selections

Discussion in 'HTML' started by Laser Lips, Feb 22, 2010.

  1. Laser Lips

    Laser Lips Guest

    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
     
    Laser Lips, Feb 22, 2010
    #1
    1. Advertising

  2. 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/
     
    Jukka K. Korpela, Feb 22, 2010
    #2
    1. Advertising

  3. Laser Lips

    Laser Lips Guest

    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
     
    Laser Lips, Feb 23, 2010
    #3
  4. 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/docbook/DocBook.UI.Page.cls?KEY=GCSP_tagbased#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/
     
    Jukka K. Korpela, Feb 23, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DJ Dev
    Replies:
    1
    Views:
    429
    Corey O'Mara
    Feb 10, 2004
  2. Alan Silver

    How can I stop it remembering my webzones?

    Alan Silver, Nov 13, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    319
    Alan Silver
    Nov 13, 2005
  3. DJ Dev

    Runtime Datagrids and checkbox selections

    DJ Dev, Feb 8, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    265
    Corey O'Mara
    Feb 10, 2004
  4. Parag Gaikwad
    Replies:
    18
    Views:
    370
    Parag Gaikwad
    Jul 26, 2007
  5. .Net Sports
    Replies:
    4
    Views:
    3,489
    Adrienne Boswell
    Sep 29, 2009
Loading...

Share This Page