Question:
Why is my WIX storage “Local” data not working after publishing? (ie. “Session” storage fails the same)
Product:
Using Editor, Velo, CMS Collections, repeaters, etc.
What are you trying to achieve:
The code works perfectly in “Preview” mode but when I “Publish” it it fails (most of the time – but very rarely it seems to work, but can’t trace why.)
I am using “local” variables to transfer a code (eg “SL1”) and description (eg “Severn Lodge – Early years” between 2 pages on my website. The from page is a Dynamic page, the second is NOT dynamic.
A “button on.Click” on the first page pulls some data from a repeater field, saves the2 fields to either Local (but Session storage failed as well). The button is defined to link to Page 2.
Code from page 1:
The code works perfectly in “Preview” mode but when I “Publish” it it fails (most of the time – but very rarely it seems to work, but can’t trace why.)
I am using “local” variables to transfer a code (eg “SL1”) and description (eg “Severn Lodge – Early years” between 2 pages on my website. The from page is a Dynamic page, the second is NOT dynamic.
A “button on.Click” on the first page pulls some data from a repeater field, saves the2 fields to either Local (but Session storage failed as well). The button is defined to link to Page 2.
// Code from page 1:
local.setItem(“gbl_coll_cd”, coll_cd);
local.setItem(“gbl_coll_desc”, coll_desc);
// Code from page 2:
let coll_cd = local.getItem(“gbl_coll_cd”)
let coll_desc = local.getItem(“gbl_coll_desc”)
$w(‘#text29’).text = "raw global vars " + local.getItem(“gbl_coll_desc”) + local.getItem(“gbl_coll_cd”) // debug
console.log("leaving Ar-Col-Tab")
console.log("raw global vars "
+ local.getItem("gbl_coll_desc")
+ local.getItem("gbl_coll_cd") )
In Preview Mode, this works perfectly. Below is Console.Logs
… and shot of actual displayed page showing successful results.
Following is what I see live once Published. Notice the special debug field I put in says both Code field and Description fields are “nulls”.
Works in preview every time. Fails almost every time after Published.
Any clues???
Mike