Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    5
    Member #
    36604

    Question Checkboxes & Radio buttons: remembered values?

    I have a very simple page (but long) with a table of pets for an online game site. How would I get the page (or the users computer) to remember which checkboxes & radio buttons have been selected if the Browser is closed or page refreshed?

    Here is the page I am wanting to implement, what I assume would be a cookie for.

    This is a table created from a bulleted list (created by a js bookmarklet) of all 'pets' contained in a person's 'lair'. I use a very simple search & replace to convert it from the list to a table. To create a database would be to greatly increase the amount of time it would take me to do each one (as I will be offering my services to other members of the site).

    Essentially, the table is a way for people to sort their 'lair'. The checkboxes allows them to remember which 'pets' have been sorted & the radio buttons will tell them where they were sorted into. That is why I need to keep it as a simple table & also why I need a way for the selected buttons & boxes to be remembered.

    As you will notice, there are already over 1600 entries & I will be adding more as time goes by. So I need something simple that doesn't require me to enter yet another value for each and every entry.

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    If you're completely against storing this in a server-side database, which I recommend in this case, this is a good application for JS's localStorage API.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    5
    Member #
    36604
    Therein lies the crux of the problem. As each person's 'lair' contains unique pets (as identified by ID#), so I would have to database each & every 'pet' for each user who wanted to use this table. Either that, or create a database of well over 8 million pet IDs.

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Sounds like localStorage then.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Junior Member
    Join Date
    Jun 2013
    Posts
    5
    Member #
    36604
    Sorry (although, I do appreciate your helpful suggestions), I suppose I should have mentioned, I am still quite new to JS & CSS. I read the page you provided a link for, although I was able to catch the gist of it, implementing it into the page in question is still beyond my coding knowledge (I'm taking courses on Udemy to try & learn it all). So I have absolutely no idea how to use the code, nor even where to put it.

    However, all I need is a reference point. As the page was created from a sample posted in another forum on sorttable.js.

    Once I see how the code works, I am able to tweak it.
    Last edited by Porthiir; Dec 04th, 2014 at 07:42 PM.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:40 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com