Hi,
I used a lightbox form, the field is required but doesn't work. when you fill out the email address field and dropdown, it fires out to the URL of each choice in the dropdown even if you did not fill out the name and phone.
Here are my codes, can you let me know what's wrong with the code or what I missed?
This is the test site https://lilitk.wixsite.com/dropdown-testsite/
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#dropdown1").options = [
{"label": "Website Packages", "value": "https://lilitk.wixsite.com/dropdown-testsite/website-pricelist"},
{"label": "Logo Design", "value": "https://lilitk.wixsite.com/dropdown-testsite/logo-design-pricelist"}
// {"label": "SEO", "value": "third"},
//{"label": "Branding", "value": "fourth"},
//{"label": "Google Ads", "value": "fifth"}
];
});
function formChanged() {
const firstnameValid = $w("#input4").valid
const lastnameValid = $w("#input3").valid
const phoneValid = $w("#input2").valid
const emailValid = $w("#input1").valid
const dropdownValid = $w("#dropdown1").valid
const isFormValid = firstnameValid && lastnameValid && phoneValid && emailValid && dropdownValid
if (isFormValid) {
$w('#button1').enable()
} else {
$w('#button1').disable()
}
}
export function button1_click(event) {
//Add your code for this event here:
let gotoUrl = $w("#dropdown1").value;
wixLocation.to(gotoUrl);
}