I have encountered a situation that has me puzzled at the moment. I am trying to refresh a repeater; the refresh works when I run the page from the Editor, either from the Run or Preview buttons, but it does not work in either a Test Site or the Live Site. If anyone can give me an idea as to what is happening, I would be grateful.
I created this site for a client about four years ago. He organizes and leads adventure scuba expeditions to various sites around the world. There is a site page to gather data about Members (not the Wix Member collection, a separate one): the usual identity and contact info, plus data on the members qualifications and certifications which determine if they can go on a specific trip. I was asked to add the capability for the Member to upload an image of their passport.
The following are portions of the code. Live site is www.brave-diving.com
/* -------------------------------------------------------------------- */
export function btnUpdatePassportImage_click(event) {
$w('#uploadButton1').show();
$w('#collapsibleTextLoad').show();
$w('#btnUploadPassportImage').show();
}
/*-------------------------------------------------------------------- */
export async function btnUploadPassportImage_click(event) {
if ($w('#uploadButton1').value.length > 0) {
$w('#uploadButton1').startUpload()
.then ((UploadFile)=> {
imgUrl = UploadFile.url;
$w('#btnMessage').label = "Upload Successful";
let errorMessage = $w('#btnMessage');
errorMessage.show("bounce");
setTimeout(() => {
errorMessage.hide("bounce");
}, 3000);
refreshRepeater();
});
} else {
$w('#btnMessage').label = "Please specify a file to upload.";
let errorMessage = $w('#btnMessage');
errorMessage.show("bounce");
setTimeout(() => {
errorMessage.hide("bounce");
}, 3000);
}
}
/* -------------------------------------------------------------------- */
function refreshRepeater() {
// put imgUrl into an array for the repeater
const imgUrlArray = [
{_id: '1', repeaterUrl : imgUrl}
];
$w("#repeaterPassportImage").onItemReady( ($item, itemData) => {
$item("#imgPassportPg").src = itemData.repeaterUrl
})
$w('#repeaterPassportImage').data = imgUrlArray;
$w('#imgPassportPg').show();
}
Hi,
Discrepancies between data viewing between the editor and the live site is often due to the collection permissions. When you are editing the site you are always logged in as an admin, meaning that you can access all data across collections without any limitations. Meanwhile when viewing the live site you have the permissions based on your logged in status.
You can learn more here: https://support.wix.com/en/article/cms-collection-permissions-overview
Does that help? Eitan