However, when I copy & paste this code into the page tab of the Code panel I keep getting the following error message: “ESLint failed to validate as an error occurred unknown character at postition 9” ??? Can anyone assist please as this is only the 1st stage in the process?
Hi Liran - the database name is “#Artwork-Images” - when I click onto the dataset settings on the index page the dataset name is coming up as “#Artwork-Images dataset” - is that why I’m getting the error message?
Could be…
Please open the properties panel (tool->properties panel), then select the Dataset, then change it’s id accordingly or copy it from there to the code.
On the next step in the code panel I am now getting the following error messages:
“#previous” is not a valid selector name and “#back” is not a valid selector name (both the buttons on the dynamic item page have been named this and both are in lower case)? If I ignore the error messages and preview the item page I am getting:
Loading the code for the Artwork-Images (Title) page. To debug this code, open chiye.js in Developer Tools.TypeError: $w(…).disable is not a functionWix code SDK Warning: The alt parameter that is passed to the alt method cannot be set to null or undefined.
Ok - I have managed to sort out the code and get it to work - however, what I actually want is code which allows the user to select a “back” or “previous” button and be re-directed BACK to the URL they just came from - NOT the previous item in a dataset. Is this possible please?
I really wanted to link it to a simple “X” on the dynamic image page - so that as soon as the item page is closed they are taken back to the index page they came from - this must be possible with code? I have managed to get the previous and next buttons to work but I am getting several error messages on the page code even though it is working which reads: "To debug this code, open chiye.js in Developer Tools.Wix code SDK Warning: The text parameter that is passed to the text method cannot be set to null or undefined. "
This warning means you’re assigning null or undefined to a text (could be $w(‘#text1’).text =…).
Regarding the ‘X’ button.
I assume you have different index pages, so you’ll need to ‘remember’ the page they came from.
You can try using wixStorage for that.
Unfortunately we do not have a tutorial that combines wix-window and wix-storage.
However you can find a tutorial that uses wix-storage to communicate between pages here , which will probably guide you in the right direction.
To get the current page url simply call:
import wixLocation from 'wix-location';
// ...
let url = wixLocation.url;
It is not possible to directly access the History object with Wix Code.