Native "memory" of section headings?

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered

So, to begin, I have used Dan Diebolt's Image Onload Technique with jQuery to dictate which sections should be opened/closed by default in view mode. Used this thread for reference: Works beautifully.

Here is an example of my problem now: I have told a section named "AAA" to be closed in my jQuery code. When I view a record, section "AAA" is closed by default. It opens & closes just fine in view mode. Now I edit the record & make changes in section "AAA" - if I leave that section open in edit mode & save the record, upon returning to view mode, I cannot open the section. (The carrot points down as if the section is open, but it is not.) If I go back to edit mode, close the section, & save, it works perfectly again in view mode. From what I've read, it is my understanding that section headers "remember" whether or not you left them open or closed; I'm thinking this may be the problem. Any thoughts on this? If it could be the problem, is there any way to disable it? Anything else that I'm missing here? I have tried adding code to my text page so that in edit mode the sections are to be either opened or closed by default, but I end up with the same issue. Any insight is greatly appreciated.

Photo of cham0is


  • 34 Points

Posted 5 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
If you want to save the open/closed state of the form's sections so they persist over repeated page loads you have to save the open/close state to a cookie or preferably to local storage. Using IOL you would read this local storage state when the page first opens and update the local storage state when the sections is opened or closed. The local storage state has to reflect the dbid, dfid, userid and device the form is accessed from. If you need more help to implement this you can contact me using the info in my profile.