Persist form entries to localstorage in a better way #14

Closed
opened 2026-02-28 10:40:20 +00:00 by ian · 1 comment
Owner
No description provided.
ian changed title from Use jsutils or another framework to persist form entries to localstorage to Persist form entries to localstorage in a better way 2026-02-28 11:25:16 +00:00
Author
Owner

e.g.

$('#settings-form').on('change', '[name]', function() {
    localStorage.setItem(this.name, this.value);
    setAPIStatus('hidden');
    clearData();
});

And on startup

  $('#settings-form [name]').each(function() {
      const val = localStorage.getItem(this.name);
      if (val !== null) $(this).val(val);
  });

Need to adapt both of these to deal with .prop('checked') not .val() on the checkbox

Adapt form entry handling to strip variables out of globals.js, just read the form live when the submit button is clicked. (trim/uppercase the callsign there)

See if localStorageGetOrDefault and the use of JSON.stringify can be streamlined

Startup still needs to handle the localstorage entries not tied to form elements, i.e. lastviewcentre/lastviewzoom and sotaRegionBoundingBoxCache.

e.g. ``` $('#settings-form').on('change', '[name]', function() { localStorage.setItem(this.name, this.value); setAPIStatus('hidden'); clearData(); }); ``` And on startup ``` $('#settings-form [name]').each(function() { const val = localStorage.getItem(this.name); if (val !== null) $(this).val(val); }); ``` Need to adapt both of these to deal with `.prop('checked')` not `.val()` on the checkbox Adapt form entry handling to strip variables out of globals.js, just read the form live when the submit button is clicked. (trim/uppercase the callsign there) See if localStorageGetOrDefault and the use of JSON.stringify can be streamlined Startup still needs to handle the localstorage entries not tied to form elements, i.e. lastviewcentre/lastviewzoom and sotaRegionBoundingBoxCache.
ian self-assigned this 2026-02-28 11:29:09 +00:00
ian closed this issue 2026-02-28 19:23:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ian/new-park-finder#14
No description provided.