Hi everyone,
I have another question for the forum. I have a graphic only repeater, not connected to any dataset. I need to have a different address of a page assigned to each graphic button according to condition Can you help me?
Thanks in advance as always
This is an idea, but doesn’t work good.
$w( '#rptUsers1' ).forEachItem(($w, itemData, index) => {
let typeUser = $w( “#dts1” ).getCurrentItem().User;
let object = $w( “#title” ).text;
$w( ‘#btnMeet’ ).onClick(() => {
if (object === “ISCRITTI” ) {
wixLocation.to( “/elenco-utenti” );
} else if (object === “FOTOCLUB” ) {
wixLocation.to( “/elenco-fotoclub” );
} else if (object === “COMUNITY” ) {
wixLocation.to( “/comunity” );
} else if (object === “PROPOSTE” ) {
if (typeUser === “POINT” ) {
wixLocation.to( “/utenti-proposte” );
} else if (typeUser === “privato” ) {
wixLocation.to( “/utente-eventi” );
} else wixWindow.openLightbox( “AuthorizationDenied” )
} else wixLocation.to( “/” );
})
})
If i understand you, 1) you can make a code when page is load, to pick a random picture, you can achieve by having multiple images in the same page and using the “View property”>“Hidden on load” for every picture and the code will use
$w('#selectedImage').show()
to appear to the user.
Also every image should link to a webpage that you want to redirect the user. you dont need to do that by code, just by clicking “Link” when you select the image (for every image you need to do that)
- if you want to display different thing depending on the user try router method
wix-router - Velo API Reference - Wix.com
NO, maybe the code is not clear.
I simply need that the button in the single box of the repeater go to different page, but the choice depend of the kind of user connected and not a simply link.
I hope to be more clearly.
Can you help me?
Maybe check
currentUser._id
with an If statement . If it’s for 2-5 people it will be easy to hardcode their id to check like :
$w('#btnMeet').onClick(() => {
if (currentUser._id === "r5cme-6fem-485j-djre-4844c49"){
wixLocation.to("/utenti-proposte");
}
}
something like that