Enter Your Information
Select Location
El Paso/Dyer, TX
Katy, TX
Temple, TX
Bandera, TX
const portalId = '2540257'
const formId = '15ce1471-473a-469e-84af-799947954491'
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
// Get the value of "location" eg "/?location=478"
let paramvalue = params.location;
document.getElementById("coming_soon_club").value = paramvalue;
function continueForm() {
document.getElementById('fullform').classList.add('d-block')
document.getElementById('fullform').classList.remove('d-none')
document.getElementById('firstbutton').classList.add('d-none')
}
function submitForm() {
// Create the new request
var xhr = new XMLHttpRequest();
var url = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`
var firstname = document.getElementById("firstname").value;
var lastname = document.getElementById("lastname").value;
var email = document.getElementById("email").value;
var phonenumber = document.getElementById("phonenumber").value;
var coming_soon_club = document.getElementById("coming_soon_club").value;
var sms_agreement = document.getElementById("sms_agreement").value;
var URL = window.location.href;
// request JSON:
var data = {
"submittedAt": new Date(),
"fields": [
{
"objectTypeId": "0-1",
"name": "email",
"value": email,
},
{
"objectTypeId": "0-1",
"name": "firstname",
"value": firstname,
},
{
"objectTypeId": "0-1",
"name": "lastname",
"value": lastname,
},
{
"objectTypeId": "0-1",
"name": "email",
"value": email,
},
{
"objectTypeId": "0-1",
"name": "phone",
"value": phonenumber,
},
{
"objectTypeId": "0-1",
"name": "coming_soon_club",
"value": coming_soon_club,
},
{
"objectTypeId": "0-1",
"name": "sms_agreement",
"value": sms_agreement,
},
{
"objectTypeId": "0-1",
"name": "lead_type",
"value": "Online",
}
],
"context": {
"pageUri": URL,
"pageName": "Landing Page 1"
},
}
var final_data = JSON.stringify(data)
xhr.open('POST', url);
// Sets the value of the 'Content-Type' HTTP request headers to 'application/json'
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
window.location.replace("/thank-you/");
} else if (xhr.readyState == 4 && xhr.status == 400) {
document.getElementById("error").innerHTML = "Please complete the missing fields"
document.getElementById('error').classList.add('d-block')
document.getElementById('error').classList.remove('d-none')
console.log(xhr.responseText)
return
} else if (xhr.readyState == 4 && xhr.status == 403) {
document.getElementById("error").innerHTML = "There was an error submitting the form"
document.getElementById('error').classList.add('d-block')
document.getElementById('error').classList.remove('d-none')
console.log(xhr.responseText)
return
} else if (xhr.readyState == 4 && xhr.status == 404) {
document.getElementById("error").innerHTML = "There was an error submitting the form"
document.getElementById('error').classList.add('d-block')
document.getElementById('error').classList.remove('d-none')
console.log(xhr.responseText)
return
}
}
// Sends the request
xhr.send(final_data)
}
$('#$submitButton').click(function() {
fbq('track', 'CompleteRegistration');
});