Link button to dynamic page

Hi guys,

im looking for this solution https://www.wix.com/corvid/forum/community-discussion/add-dynamic-page-link-to-a-button but using a different field from the collection, not the #email. I have a field named #teamName, I want to use this field for my link and land in #teamName dynamic page.

So instead of
wixLocation.to (`/student/info/’ + userEmail);

i would like to have
wixLocation.to (`/student/info/’ + teamName);

I kind of tried to do the same as his to retrieve the field but it didn’t work.

Thank you for the help!

Post your entire code please.

Right now the code below works but in order to work I had to add an extra field(Team name) to the form. I would like to access this field without having to add it to the form and land in the specific dynamic page.

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';

$w.onReady(function () {
$w("#forgotPassword").onClick((event) => {
//wixWindow.lightbox.close()
wixUsers.promptForgotPassword()
.then(() => {
//
})
.catch((err) => {
let errorMsg = err; //"The user closed the forgot password dialog"
});
});
});
export function submit_click_1(event) {
let email = $w("#email").value;
let password = $w("#password").value;
let team = $w("#teamName").value;

wixUsers.login(email, password)
.then(() => {
console.log("User is logged in");
wixLocation.to("/form/" + team);
})
.catch((err) => {
console.log(err);
$w("#errorMessage").expand();
});
}

Im doing this

but I don’t want to ask for the team in order to land in that user’s team.

So from where do you want to retrieve the Team ?

when the user registers he submits the team name, his name, email, all the info goes to the same collection

import wixData from 'wix-data';// at the top of the code
//...your code.....
export function submit_click_1(event) {
    let email = $w("#email").value;
    let password = $w("#password").value;
    Promise.all([
        wixData.query("COLLECTION NAME")
        eq("email", email)
        .distinct("team"),
        wixUsers.login(email, password)
    ])
    .then(r => {
        let retrievedTeams = r[0].items;
        let team = retrievedTeams[0];
        wixLocation.to("/form/" + team);
    })
})
//...the rest of the code

Thank you! Will try it

  1. Publish your site.

  2. Go to the live site and navigate to the specific page you want to link to.

  3. Copy the page URL.

  4. Go back to the Editor.

  5. Click the element you want to link.

  6. Open the link panel. Click here for instructions for specific elements.

  7. Select Web Address .

  8. Paste the URL in the What’s the web address (URL)? field.

  9. Click Done .
    official site

Looking For the Same Please Help me

https://myindigocardx.com/