Submit button - Redirect not working

Brilliant. That works perfectly. So for others’ reference, the corrected code is below.

I have a follow-on question regarding the wixLocation.to. I would like to direct users to a dynamic page on my site (or perhaps to an external site) defined by either an element in my dataset or one of the input elements, e.g. mywebsite.com is available for purchase - Sedo.com .

In my simplistic way, I attempted a concatenation within the wixLocation statement:

wixLocation.to (“/” + ‘${$w(“#text1”).text}’)

This did not at all work. Is there a way to do this?

import {sendEmail, sendEmailWithRecipient} from ‘backend/email1’;
import wixLocation from ‘wix-location’;

$w.onReady( function () {
$w(“#dataset1”).onAfterSave(sendFormData);
$w(“#button1”).onClick( (event, $w) => {
wixLocation.to (“/pageiwanttoredirectusersto”)
} );
});

function sendFormData() {
const subject = This email contains responses from our website;
const body = Here are the responses: \rresponse1 ${$w(" [#radioGroup1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23radioGroup1) ").value} \rresponse2 ${$w(" [#checkbox1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23checkbox1) ").checked} \rresponse3 ${$w(" [#dropdown1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dropdown1) ").value} \rresponse4 ${$w(" [#input1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23input1) ").value};
const recipient = $w(" #input8 ").value;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));
sendEmail(subject, body)
.then(response => console.log(response));
}

Glad it worked for you. I’m not at a computer, but try writing it differently. Maybe something like this
wixLocation.to(/${$w("#text1").text})

That doesn’t quite work either. It navigates to: www.mywebsite.com/${$w("

I want to go to another page after using a delete button. Submits work fine but delete just stays on the page.

What are you deleting? How are you deleting? And how are you trying to redirect to another page?

This doesn’t work. I have been trying everything I know to try and get a redirect to a page with a query paraemter and it does not work using wix location or session variables…The page is called and the code is successfuly parsed (I’m logging it) but the page is not rendered. When I look in browser address bar the correct address is in there. If I click on it and hit enter, the page renders…

Please provide the link you found…

You’re right :confounded::scream_cat: As per code below… the button click event has to go in page ready otherwise it won’t work.

@yisrael-wix Hello. I have submitted several help tickets, spoke with several Advanced Wix Experts, shared my screen and screenshots over multiple weeks now…and have received no solution to my issue. Is there a better way to get help? Please guide us, as we none of the Wix Experts or Customer Care reps can help me. They simply keep expediting more and more tickets to other Advanced Experts.

http://somup. com/cYQvnQlQ0j

———— The ‘Apply’ button does not properly connect to the correct ‘Title’ or job title. REPEATER > CONNECT TO DATA > BUTTON … however, noone at Wix has a solution and has left me at a tremendous loss of business. Kindly direct me to someone that can help. Stay well and all the best!

@contact53788 Please add your own issue into a new post instead of bumping up an old post.

Explain what you are trying to do, what works, and what doesn’t. Also, add any code in a code block as stated in the Forum Guidelines.

This is an old post and is being closed.