Hi so i would like to be able to change a text value based by adding two fields together which i confident that i can do / code
two tasks
- these fields would only be shown for ‘not the register author’ and not logged in.
- i would like to trim 4 characters from the middle of the first field i.e ‘my’
so it might read something like this for logged in users
$For my Friend (which is the complete string )
for non logged in users
‘my’ would be trimmed out
which would leave and be replaced by
$For $Name’s Friend
so the first field, trimmed by 4 then the second field in the middle to complete the string
is this possible ?
Thanks
Adam
So i already have in place the following, so i can add text to a field key
$w.onReady(() => {
$w( “#dynamicDataset” ).onReady(() => {
const item = $w( “#dynamicDataset” ).getCurrentItem();
const nickName = item.nickName;
$w( ‘#text159’ ).text = 'For ${nickName}'
;
1. I would like to remove the first two characters from ${nickName} when this is rendered on screen from the database for non-logged in user
2. can i use #text159 twice in my code for l non-logged in user using code like this below that i already have for showing different column Strips
let user = wixUsers.currentUser;
let isLoggedIn = user.loggedIn;
$w.onReady(() => {
if (isLoggedIn){
doIfLoggedIn();
} else {
$w( “#columnStrip13” ).expand();
$w( “#columnStrip12” ).collapse();
}
})
wixUsers.onLogin(u => {
isLoggedIn = u.loggedIn;
doIfLoggedIn();
})
function doIfLoggedIn(){
$w( “#columnStrip12” ).expand();
$w( “#columnStrip13” ).collapse();
}
Thanks
Adam