SPARK CUSTOM REGISTRATION FORM CODE
How did you hear about us? *
What type of home are you looking for?
What is your age range?
What is your desired move-in date?
What is your price range?
Do you have any pets?
Is there anything specific you are looking for in a home?
I consent to receiving emails from pacific cove properties. i understand i can unsubscribe at any time.
Register with Corporate
window.onload = function() { // Hides spam trap document.getElementById("are_you_simulated").style.display = "none";
// Hides Employer/Brokerage field at the start hideBrokerageEmployer(); }
var submitting = false; var agentField = document.getElementById("agent");
function hideBrokerageEmployer() { if (agentField === null) { return }; if (agentField.options[agentField.selectedIndex].text == "No") { document.getElementById("hidden-agent").style.display = "none"; } else { document.getElementById("hidden-agent").style.display = "table"; } }
// Show/Hides Brokerage/Employer field based on Yes/No selection. if (agentField) { document.getElementById("agent").onchange = function() { hideBrokerageEmployer(); } }
function submitRegistrationForm(element) { var form = document.querySelector("body#spark-registration-form form, form#spark-registration-form"); var missing = ""; var required = { contact_email: "Email" }; var customRequired = document.querySelectorAll("input:required, textarea:required, select:required"); var questionsRequired = {answers_6906: 'How did you hear about us?'};
// Adds custom required inputs to the 'required' object for (var i = 0; i < customRequired.length; i++) { required[customRequired[i].id] = customRequired[i].parentNode.firstElementChild.innerHTML.replace("*", ""); } // Adds required question inputs to the 'required' object for (var key in questionsRequired) { required[key] = questionsRequired[key]; } // Iterates through required fields and adds any that have // not been populated to 'missing' list for (var key in required) { var elements = Array.from(document.querySelectorAll("[id^='"+ key + "']")); if (elements.length > 0) { var missing_field = true;
elements.forEach(function (el) { if ((el.length < 1) || (el && ((el.type == "checkbox" && el.checked) || (el.type == "radio" && el.checked) || ((el.type != "radio" && el.type != "checkbox") && el.value) || (document.getElementById(key + "_other_text") && document.getElementById(key + "_other_text").value)))) { missing_field = false; } }); if (missing_field) { missing += "- "+ required[key] + "\r\n" } } } // Tests email input value against RFC 5322 Official Standard Email Regex var email = document.getElementById("contact_email").value; if (!/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21```-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test(email)) { missing += "- Email is invalid\r\n"; } if (missing != "") { alert("The following fields are incomplete:\r\n"+ missing); return false; } // Prevents duplicate submissions if (submitting) { return false; } submitting = true form.submit(); }