secure.windows-usa.com Open in urlscan Pro
52.202.168.65  Public Scan

URL: https://secure.windows-usa.com/
Submission: On January 20 via api from VN — Scanned from DE

Form analysis 1 forms found in the DOM

POST /free_answer

<form class="edit_survey" id="edit_survey_6435134" action="/free_answer" accept-charset="UTF-8" data-remote="true" method="post"><input name="utf8" type="hidden" value="✓">
  <div class="card border-0 shadow-custom free-answer-card">
    <div class="card-body p-5 ">
      <div class="form-row">
        <input value="809" type="hidden" name="survey[page_id]" id="survey_page_id">
        <div class="form-group col-sm-8 offset-sm-2 px-3">
          <label class="label-custom label-custom-sm"> What's your zip code? </label>
          <input type="" name="survey[results][0][value]" id="zip_code" class="form-control form-control-lg question_input_1529" placeholder="_____" required="required" maxlength="5">
          <input type="hidden" name="survey[results][0][question_id]" id="survey_results_0_question_id" value="1529">
          <small>
          </small>
        </div>
        <input type="" name="survey[results][1][value]" id="" class="form-control form-control-lg question_input_1530" placeholder="" hidden="hidden">
        <input type="hidden" name="survey[results][1][question_id]" id="survey_results_1_question_id" value="1530">
        <div class="form-row">
          <div class="col-12">
          </div>
        </div>
        <script>
          var emailValid = false;
          var phoneValid = false;
          $("#phone_number").mask('000-000-0000', {
            placeholder: "___-___-____"
          });
          $("#ssn").mask('000-00-0000', {
            placeholder: "__-__-____"
          });
          $("#zip_code").mask('00000', {
            placeholder: "_____"
          });
          // months
          $("#months").mask('00', {
            placeholder: "__"
          });
          $("form").submit(function(e) {
            if ($("#months").length > 0) {
              return validateMonths($("#months"))
            }
          });
          $("#months").keyup(function() {
            validateMonths(this)
            removeLeadingZero(this, 2)
          })

          function validateMonths(input) {
            var val = $(input).val()
            $(".invalid-text").remove()
            if (val <= 12) {
              console.log("valid months")
            } else {
              $(input).parent().append("<label class='help-text invalid-text'>Months must be between 0 and 12</label>")
              return false
            }
          }

          function removeLeadingZero(input, length) {
            var val = $(input).val();
            if (val.length == length && val[0] == "0") {
              $(input).val(val[1]);
            }
          }
          // Date Validations using Domain's date format
          var dateFormat = "mm/dd/yyyy";
          var mask = dateFormat.replace(/\w/gi, '0');
          $(".date-field").mask(mask, {
            placeholder: dateFormat
          });
          $("#birth_date").mask(mask, {
            placeholder: dateFormat
          });
          $("form").submit(function(e) {
            if ($("#birth_date").length > 0) {
              return validateDateField($("#birth_date"))
            }
          });
          $("#birth_date").keyup(function() {
            validateDateField(this)
          })
          $(".date-field").keyup(function() {
            validateDateField(this)
          });

          function validateDateField(input) {
            var val = $(input).val()
            $(".invalid-text").remove()
            if (val.length == 10) {
              if (moment(val, dateFormat.toUpperCase()).isSameOrAfter('1910-01-01')) {
                console.log("valid date")
              } else {
                $(input).parent().append("<label class='help-text invalid-text'>Invalid Date</label>")
                $(input).val("")
                return false
              }
            } else {
              $(input).parent().append("<label class='help-text invalid-text'>Date too short</label>")
              return false
            }
          }
          // if type is tel - only allow numbers
          $('input[type=tel]').keyup(function() {
            this.value = this.value.replace(/[^0-9-/\.]/g, '');
          });
          if ($("#date-selectors").length > 0) {
            var html = "<select class='' id='date-months'><option>1</option></select>"
            $("form").prepend(html);
          }
          // fill ip_address id with value of user's ip address
          if ($("#ip_address").length > 0) {
            $.get('https://jsonip.com', function(res) {
              $("#ip_address").val(res.ip);
            });
          }

          function validateEmailAddress(emailAddress) {
            var pattern = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
            return pattern.test(emailAddress);
          }

          function addErrorText(input, text) {
            $(input).parent().append("<label class='help-text invalid-text'>Invalid " + text + "</label>")
            $(input).addClass("invalid-input")
          }

          function removeErrorText(input) {
            var el = $(input).siblings(".invalid-text")[0]
            $(el).remove()
            $(input).removeClass("invalid-input")
          }

          function addVerifyingText(input) {
            $(input).parent().append("<label class='help-text verifying'>Verifying...</label>")
          }

          function removeVerifyingText(input) {
            var el = $(input).siblings(".verifying")[0]
            $(el).remove()
          }

          function checkTwilio(input, phoneNumber) {
            var areaCode = phoneNumber.substr(0, 3)
            var badAreaCodes = ["800", "833", "844", "855", "866", "877", "888"]
            removeVerifyingText(input);
            if (badAreaCodes.indexOf(areaCode) >= 0) {
              addErrorText(input, "Phone Number")
              phoneValid = false;
              console.log("bad area code")
            } else {
              addVerifyingText(input);
              $.ajax({
                url: "/check-phone",
                method: "POST",
                dataType: "script",
                data: {
                  phone_number: phoneNumber
                },
                // success: function() {console.log("twilio success")},
                // complete: function() {console.log("twilio complete")}
              }).complete(function(data) {
                removeErrorText(input);
                removeVerifyingText(input);
                console.log(data.responseText)
                if (data.responseText == "success") {
                  phoneValid = true;
                } else {
                  addErrorText(input, "Phone Number")
                  phoneValid = false;
                }
              });
            }
          };

          function validateEmail(input) {
            var address = $(input).val();
            var group = $(input).parents(".form-group")[0]
            $(group).find("label").remove(".invalid-text");
            $(group).find("input").removeClass("invalid-input");
            if ($(input).length > 0) {
              if (!validateEmailAddress(address)) {
                // alert("Invalid Email Address!");
                addErrorText(input, "Email Address")
                emailValid = false;
              } else {
                $(input).mailcheck({
                  suggested: function(element, suggestion) {
                    // console.log(suggestion)
                    $(element).parent().append("<label class='help-text invalid-text'>Did you mean <u id='suggestion'>" + suggestion.full + "</u>?</label>")
                    $(element).addClass("invalid-input")
                    suggestionText();
                    emailValid = true;
                  },
                  empty: function(element) {
                    // console.log(element);
                    emailValid = true;
                  }
                })
              }
            } else {
              emailValid = false;
            }
          }

          function validatePhone(phoneInput) {
            var group = $(phoneInput).parents(".form-group")[0]
            $(group).find("label").remove(".invalid-text");
            $(group).find("input").removeClass("invalid-input");
            var phoneNumber = $(phoneInput).val();
            if ($(phoneInput).val().length > 1) {
              removeErrorText(phoneInput);
              checkTwilio(phoneInput, phoneNumber);
            } else {
              console.log("number no length")
              addErrorText(phoneInput, "Phone Number")
            }
          }
          suggestionText = function() {
            $("#suggestion").click(function() {
              var group = $(this).parents(".form-group")[0]
              var input = $(group).find("input");
              input.val($(this).text())
              $("label").remove(".invalid-text");
              $("input").removeClass("invalid-input");
            })
          }
          $("#email_address").change(function() {
            validateEmail(this);
          })
          // $("#phone_number").change(function() {
          //     validatePhone(this);
          // })
          var previousValue;
          $("#phone_number").keyup(function() {
            var currentValue = $(this).val().replace(/-/g, "")
            console.log(previousValue, currentValue)
            if (previousValue != currentValue && currentValue.length > 5) {
              validatePhone(this);
              previousValue = currentValue
            }
          });
          $("#phone_number").change(function() {
            var currentValue = $(this).val().replace(/-/g, "")
            if (currentValue.length < 10) {
              addErrorText(this, "Phone Number")
            }
          })

          function validateForm(emailInput, phoneInput) {
            // validatePhone(phoneInput);
            // validateEmail(emailInput);
            // console.log("email " + emailValid)
            // console.log("phone " + phoneValid)
            if (emailInput.length > 0 && !emailValid) {
              toastr.error('Email Address Invalid')
              return false;
            }
            if (phoneInput.length > 0 && !phoneValid) {
              toastr.error('Phone Number Invalid')
              return false;
            }
          }
          $("form").submit(function(e) {
            var emailInput = $(this).find("#email_address");
            var phoneInput = $(this).find("#phone_number");
            return validateForm(emailInput, phoneInput);
          });
        </script>
      </div>
    </div>
    <div class="form-row next-button ">
      <div class="col-md-6 offset-md-3 px-3 next-container">
        <div class="form-row">
        </div>
        <button class="mx-auto btn-custom " type="submit"> NEXT </button>
      </div>
      <div class="col-md-10 offset-md-1 px-3">
        <div class="form-row">
        </div>
      </div>
    </div>
  </div>
</form>

Text Content

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

YOU MAY BE ELIGIBLE TO SAVE ON NEW WINDOWS TODAY!
CHECK ELIGIBILITY IN 60 SECONDS!




What's your zip code?


NEXT



Roofs America | Copyright 2020
Privacy Policy | Terms of Use | Do Not Sell My Personal Data