SSDI Feathery Redirection With Chatgptbuilder
Wed Oct 11 2023 15:50:57 GMT+0000 (Coordinated Universal Time)
Saved by
@nikanika4425
// Get form fields
const {
dob_month,
dob_day,
dob_year,
working,
seen_doctor,
have_attorney,
have_applied,
first_name_ssdi,
last_name_ssdi,
email_ssdi,
phone_ssdi
} = feathery.getFieldValues();
// Calculate age based on DOB
const birthDate = new Date(dob_year, dob_month - 1, dob_day);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDifference = today.getMonth() - birthDate.getMonth();
if (monthDifference < 0 || (monthDifference === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
// Set the calculated age to the 'age' field
feathery.setFieldValues({ age: age });
// First Button Logic
if (
(age >= 49 && age <= 62) &&
(working === "part time" || working === "not working") &&
seen_doctor === "yes" &&
(have_attorney === "no" || have_attorney === "had") &&
(have_applied === "first time" || have_applied === "previous")
) {
const thankYouURL = `https://www.ssdi-approvals.com/thank-you-bot?first_name=${first_name_ssdi}&last_name=${last_name_ssdi}&email=${email_ssdi}&phone=${phone_ssdi}`;
location.href = thankYouURL;
}
// Second Button Logic (for the leftovers)
else {
location.href = 'https://www.ssdi-approvals.com/thank-you-np';
}
content_copyCOPY
Comments