Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Thanked 0 Times in 0 Posts

    how to save in local storage? (html 5 new features)

    i want to save an info in local storage and post it under the table.. how can i do that?

    <title>Offline App(Traffic Enforcement)</title>
    <link rel="stylesheet" type="text/css" title="Preferred" href="popAddVio.css" />

    <script type="text.javascript">

    function save() {
    try {
    var date = document.getElementById('textDate').value;
    var plate = document.getElementById('textPlate').value;
    var name = document.getElementById('textName').value;
    var address = document.getElementById('textAddress').value;

    localStorage.lDate = date;
    localStorage.lPlate = plate;
    localStorage.lName = name;
    localStorage.lAddress = address;

    } catch (e) {
    alert("Error save");
    function load() {

    var storedValue = localStorage.lDate;
    if (storedValue) {
    document.getElementById('date').value = storedValue;

    <body >

    <h1>Add Violations</h1>

    <div id="vioForm">
    <table border="0" width="400" align="center">
    <td><input id="vioDate" type="date" name="textDate" value="2011-01-13"/></td>
    <td><label>Plate #:</label></td>
    <td><input id="vioPlate" type="text" name="textPlate"</td>
    <td><label>Driver's Name:</label></td>
    <td><input id="vioName" type="text" name="textName" /></td>
    <td><input id="vioAddress" type="text" name="textAddress"/></td>
    <td><select id="combo">
    <option value="move"> Moving Violation </option>
    <option value="park"> Parking Violation </option>


    <form id="buttons">
    <input type="button" value="SAVE" onclick="save()" />
    <input type="button" value="CLOSE" onclick="window.close()" />


  2. #2
    Regular Coder
    Join Date
    Apr 2012
    St. Louis, MO
    Thanked 101 Times in 101 Posts
    var storage, fail, uid;
      uid = new Date();
      storage = window.localStorage;
      fail = storage.getItem(uid) != uid;
      fail && (storage = false);
    if(storage){ alert("Storage YES"); } else { alert("Nope.. ain't happenin'"); }
    Upload to a server; this will let you know if localStorage is working.

    localStorage is set: storage.setItem() (based upon the variable 'storage', set above)
    localStorage is get: storage.getItem()

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts