Hey all,
I signed up for here just a few minutes ago.
I’m building a project for a client, and I was wondering if anyone knew if this is possible to do with Wix…
I need to send people to a specific page (it would be a dynamic title one) after they submit their form to sign up (I’m using a custom sign up form).
Is this possible? How would I do this if so?
If you are using a submit button, then you can simply set the submit button to go to a new page where your lightbox used for signup can appear on.
https://support.wix.com/en/article/adding-a-submit-button-to-your-form
To do it through code, then you can simply add something that happens after the form has been submitted and saved.
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#onAfterSave
Thanks for the reply! Do I need to connect it to a dataset? How do I know which one?
Also, I’m assuming a sign up form button would be considered a submit button?
Oh, just saw what the dataset does. However, they don’t just need to submit info, they need access to member only parts of the site. Is this possible using the Dataset?
Okay, so to clarify, you are using the second option of Member Signup choice and using the Custom version, whereas I was talking about the Corvid option as shown here on this page…
https://support.wix.com/en/article/about-the-member-signup-form
You can find out more about that option of signup here.
https://support.wix.com/en/article/creating-a-custom-signup-form-for-your-members-area
When you use this custom option, you don’t have the option of linking the submit button to another page, when the user signs up through the form and clicks on signup, this custom lightbox will just close and the user will be logged into the site.
To have this option you must have the Wix Members app added to your site already.
https://support.wix.com/en/article/adding-a-members-area-to-your-site
If you were to use the Corvid option and create your own signup and login lightboxes, then you can easily move the user onto another page after they have filled in and submitted the form…
Signup lightbox code example
import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#registerButton").onClick( (event) => {
let email = $w("#email").value;
let password = $w("#password").value;
let first = $w("#firstName").value;
let last = $w("#lastName").value;
wixUsers.register(email, password, {
contactInfo: {
"firstName": $w('#firstName').value,
"lastName": $w('#lastName').value,
}
} )
.then( (result) => {
let resultStatus = result.status;
wixWindow.lightbox.close();
wixLocation.to("/sign-in-status"); //Change the URL ending to whatever page you want to send the user to after they log in.
} );
} );
});
Login lightbox sample code example
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 loginButton_click(event) {
let email = $w("#email").value;
let password = $w("#password").value;
wixUsers.login(email, password)
.then( () => {
console.log("User is logged in");
wixLocation.to("/account/my-account"); //Change the URL ending to whatever page you want to send the user to after they log in.
} )
.catch( (err) => {
console.log(err);
$w("#errorMessage").expand(); // You can delete this line if you are not going to add an error message. Use a regular text element set to 'collapse on load' from the Properties Panel.
} );
}