I have a form on my home page that users fill in their Name and Phone number, then select from a drop-down (connected to a read-only data set) and submit that information to a write-only dataset. I want the submit button to write the user information (name, phone, drop-down selection) within the Wix dataset, AND then re-direct the user to another page depending on which drop-down selection they choose.
Currently, the form just submits the user information to a dataset and does not redirect them to another page, but can I have it redirect them to another page (i.e. /Homevalutaion when they select the drop-down “what’s my home value?” or /Sell when they select “sell my home”).
$w.onReady(function () {
let toInsert = {
"name": $w("#myElement").value, //see Insert api
"phoneNumber": "John",
"last_name": "Doe"
};
wixData.insert("myCollection", toInsert)
.then( (results) => {
// here is the redirect function
let value = $w("#dropdown").value;
let id = `${value}`
wixLocation.to(`/Homevalutaion /${value}`);
});
});
Hi Ajit, that is what I am trying to do. A user selects an option from the dropdown AND includes their name/phone. The information gets saved to the dataset where I would then set up an automation to send to an email address.
Then the user should be redirected to the page based on the option as you have correctly wrote above.
Thank you for your suggestion, I will give it a shot!