I have FINALLY successfully implemented the Login/My Profile member page but I have three issues:
In the database connection menu I want to change the Stay On This Page to my site’s HOME page. The only choice is a Link, but clicking on lick adds a link to the submit button which Breaks this?
If I use the Tab key when filling out the form, it randomly jumps to different input boxes, even though the boxes are named input#1, input#2 etc…
Based on a reply, I added the following to page code
wixLocation.to(“/home”);
And as usual, it BROKE THE PAGE, even after taking this out. The Submit button now no longer updates my database. Is wix code really this flakey? If I had been doing this with C-language I would have been done three weeks ago!
The video on YouTube done by Nayeli, shows her doing it without any wix code. But when I click on link from within the submit button, I do not get a Choose menu.???
After refreshing cache, it appears to be working again. But I still have not figured out how she did it. Look at her video at around time code: 32:15. When she changes Stay on Page to A Link, she gets a CHOOSE menu. I am not getting that, WHY?
oops, just tried it again and it is broken. Adding last name in form and clicking submit. Nothing happens. I should get the Successful Message.? It worked yesterday?
export function button2_click() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button2”).label = “Login”;
$w(“#button3”).hide();
} );
}
// user is logged out
else {
let userId;
let userEmail;
// prompt the user to log in
wixUsers.promptLogin( {"mode": "login"} )
.then( (user) => {
userId = user.id;
return user.getEmail();
} )
.then( (email) => {
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query("CVOA_members")
.eq("_id", userId)
.find();
} )
.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
"_id": userId,
"email": userEmail
};
// add the item to the collection
wixData.insert("CVOA_members", toInsert)
.catch( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w("#button2").label = "Logout";
$w("#button3").show();
} )
.catch( (err) => {
console.log(err);
} );
}
}
export function button3_onclick() {
wixLocation.to(/CVOA-MemberProfile/${wixUsers.currentUser.id});
Specific Issue. When defining the Submit Changes button I have it set to SUBMIT. It DOES update the fields in the database. So far so good. I get the Success Message as defined in the dynamic form. What I am trying to do is have it go to the home page after successful submission. The minute you change Stay On Page to A Link, it seems to populate the LINK field OUTSIDE of the Database Connect Menu and subsequently breaks the form. Submit no longer works because it is obviously confused, since it now has both Submit to datbase AND go to a link. In the YOU TUBE video done my Nayeli, when she changed from Stay On Page to A Link, the video seems to bring up a CHOOSE menu, which I do not see. I know this video was done before release of wix code so maybe thats the issue?
FINALLY! I was “CLICKING” instead of SCROLLING WITH MOUSE WHEEL! I would have expected the Down Arrow next to Link to do the same thing. Thats what I was trying.