I need to identify the Current Logged In User and if the Boolean Field “system1” =true (for that specific user) I need the text in #text30 to display “Subscribed” and if “system1” =false display “Join Now”
Hey,
You can use the currentUser function of the Wix-Users API. Check out the documentation here .
Good luck!
Tal.
Thank you Tal! I finally realized my mistake! Now how would I duplicate this for a few other systems I have?
For example I have a boolean field called system 2
and I need to change the text in #text31
I know i can’t have multiple .onReady or else it will just use the last one
- I guess what I really need to know is where do I start to copy the code and where do I paste it so I can do exactly what I just did but for another boolean field and textbox
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
$w.onReady(() => {
$w(“#dynamicDataset”).onReady(() => {
let SystemOne = $w(“#dynamicDataset”).getCurrentItem().system1;
if (SystemOne === true ) {
$w(“#text30”).text = “Subscribed”;
}
});
});
- Thanks in advance and my apologies but I’m not very good with explaining what I need in computer lingo!
Hey,
I’m not sure that I fully understand what’s the scenario. Can you send a screenshot of the collection? Does the same record have system1 , system2 and system3 fields? Do you wish to change the text whenever all these fields are set to true?
Moreover, I recommend renaming the IDs to have more meaningful names. It will be easier for you to code with meaningful functions, variables and IDs names.
Tal.
Problem solved! Basically I needed to do what I just did but for a handful of different texbox’s. Originally I kept getting an error message but it was becausae I wasn’t breaking up the code right. The picture below will describe what I’m trying to say better. Thank you so much for all the help!
Now for my next problem…
- Do you know how I can make a button submit data to my database, refresh the database and refresh the page on click?
Right now I have a button, button23, that submits user data to a database and then returns to my Members page on click. However, when it returns to the Members page the data that was just submitted doessn’t show up until after I refresh the page.
Hey,
I’m glad the issue was resolved. Can you please post a new thread of your different question?
Thanks,
Tal.