I need help with how as new user to my site can be re-directed to a Widget that can capture them choosing from a Carousel - their favourite Fruit - then they hit Submit button and it saves to database under Profile - ‘Fruit’ field. Once there is a value in the Profile - ‘Fruit’ field, it should never go back to the widget for any future pop-ups.
Therefore logic is:
- New User registers by either FB + Google + Email.
- Upon registering (or logging on via FB/Google) be redirect with the widget popup to enter the Fruit selection from Carousel. Then submit.
- Any future login will check for a value in field ‘Fruit’ - if there is a value, do not show the widget popup and it will just land on the regular home page logged in. If there is NO value for field ‘Fruit’ upon login - it will popup the widget (so we can capture the Fruit field value they select from Carousel and hit Submit on to send to db)
I am not sure of the code required to do this. Help experts.
Roy
A simpler way to describe my requirement for help is:
- How do I display (popup) and select an image from a carousel (of images) and post selection value to database?
- How do I only show this carousel after user is logged only if there is no image selection information in the database?
So far I have coded this on home page. Note that I set the object #gallery2 to Hidden as a default value. Unfortunately when I log in as user - I am not sure why #gallery2 is not showing on the home page.
$w . onReady ( function () {
// Write your JavaScript here
// To select an element by ID use: $w('#elementID')
// Click 'Preview' to run your code
**import** wixUsers **from** 'wix-users' ;
$w . onReady (() => {
wixUsers . onLogin (( user ) => {
myFunction ()
});
**if** ( wixUsers . currentUser . loggedIn ) {
myFunction ()
} **else** {
$w ( '#gallery2' ). show ();
}
});
**function** myFunction () { //set the name to what it does or something
$w ( '#gallery2' ). show ();
}
});
Also - how can I echo a comment to even know it is going into this code… as not even sure it is being executed. I am fairly new to Wix.