Hi Programmers
Problem:
on a website there is a “get subscribers form” with “dropdown field” with several choices - lets say A, B and C.
According to the choice of the subscribers, after submitting, I wanna send them to the different pages of the website.
choice A >>> Page A
Choice B>>> Page B
Choice C>>> Page C
etc…
does somebody has an experience or “know-how” how to do that?
Thank you very much
Vladimir
GOS
thank you for the prompt answer.
Yes, I agree, we have to look first here. On the other side, most of these examples are single way solutions. Maybe they are OK for you to understand and to code, but not for me…
I am looking for similar examples, which are then easier to mirror…
Hi Coders…
I have seen the code from the recommendation…
Maybe I get lucky and I find the solution from similar examples
(Please, See the original post at the beginning above)
CASE:
DROPDOWN FIELD
(which is embedded in the “Get subscribers Form”)
Each choice should lead to the different page of the website.
FORM
(where, as you can guess already, I try to collect other data from the visitors)
SUBMIT BUTTON
and only then, when blank inputs in the forms are filled up, we can press that button
is it good idea to start with thic sort of coding
import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(“#dropdown1”).onChange((event) => {
let url = $w(‘#dropdown1’).value;
wixLocation.to(url);
});
});
To do that you need to be creating your own form and not using the Wix Forms app own ‘Get Subscribers Form’ as that is all setup for you and you just change the settings for it.
https://support.wix.com/en/article/adding-and-setting-up-a-get-subscribers-form
You can add your own subscribe form on your website like I have done myself with this code here.
import wixCRM from 'wix-crm';
$w.onReady(function() {
$w("#PublicContactUs").onAfterSave(() => {
let name = $w('#publiccontactName').value;
let email = $w("#publiccontactEmail").value;
let subject = $w("#publiccontactSubject").value;
let message = $w("#publiccontactMessage").value;
let label = ["Contacted Us"];
wixCRM.createContact({
"name": name,
"emails": [email]
})
.then((contactId) => {
// Need to use the triggered email name
return wixCRM.emailContact('publiccontactus', contactId, {
"variables": {
// Need to use the triggered email variable names
"name": name,
"email": email,
"subject": subject,
"message": message
}
});
})
.catch((err) => {
// handle the error if the email wasn't sent
console.log(`Error: ${err}`);
});
});
});
$w("#NewSubscriber").onAfterSave(() => {
let name = $w("#newsubscriberName").value;
let email = $w("#newsubscriberEmail").value;
let privacyPolicy = $w("#newsubscriberPrivacy").value;
let label = ["Subscribed"];
wixCRM.createContact({
"name": name,
"emails": [email]
})
.then((contactId) => {
// Need to use the triggered email name
return wixCRM.emailContact('newsubscriber', contactId, {
"variables": {
// Need to use the triggered email variable names
"name": name,
"email": email,
//"privacyPolicy": privacyPolicy << - not defined in the triggered email
}
});
})
.catch((err) => {
// handle the error if the email wasn't sent
console.log(`Error: ${err}`);
});
});
Wix Forms app is not part of Wix Corvid.
https://support.wix.com/en/ascend-by-wix/wix-forms
How To Add Subscribe Form - WIX Website Tutorial
The Wix Forms app does most of the work behind the scenes, so you just have to add the fields that you want to use, without having to do all the code for it as well.
Also, note that the Wix Forms app uses submissions tables and not datasets which are used in Wix Corvid to collect and store your info etc.
https://support.wix.com/en/article/viewing-your-wix-forms-submissions-table
https://support.wix.com/en/article/about-datasets-6368396
Thanks GOS
I understand you…
It will be long story for me. For now, I let it be…it is too much for me.