Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype="html">
- <head>
- <meta charset="utf-8">
- <title>Lead Submission Form</title>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
- <!-- Optional theme -->
- <!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
- <!-- Latest compiled and minified JavaScript -->
- <!--script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
- <!-- end bootstrap -->
- <style>
- form {
- margin:auto;
- width:80%;
- }
- label {
- clear:all;
- display:block;
- }
- .currencyinput {
- border:1px inset #ccc;
- }
- .currencyinput input {
- border:0;
- margin-left:2px;
- }
- input.currency:before {
- content:attr(data-symbol);
- float:left;
- color:#aaa;
- }
- fieldset {
- border:0;
- min-width:48%;
- }
- textarea {
- height:8em;
- width:32em;
- }
- </style>
- </head>
- <body>
- <div id="profiles">
- <select id="user-selection">
- <option value="rich-brat">Richy Rich</option>
- <option value="poor-hillbilly">Hill Billy</option>
- <option value="average-joe">Joe Schmoe</option>
- </select>
- <button id="change-user" onclick="setUserProfile('user-selection')">Set User</button>
- </div>
- <!-- DROPDOWN to auto-fill fields with generic data -->
- <form id="formMama" method="post" action="" onSubmit="validate()">
- <fieldset id="user-info">
- <legend>User Info</legend>
- <label for="user-givenname">Firstname</label>
- <input id="user-givenname" name="FNAME" required placeholder="John" size="15">
- <label for="user-surname">Lastname</label>
- <input id="user-surname" name="LNAME" required placeholder="Smith" size="15">
- <label for="user-address">Address</label>
- <input id="user-address" type="text" name="ADDRESS" required placeholder="123 Sesame Street">
- <label for="user-city">City</label>
- <input id="user-city" name="CITY" required placeholder="Los Angeles" size="15">
- <label for="user-state">State</label>
- <input id="user-state" name="STATE" required placeholder="CA" maxlength="5" size="5">
- <label for="user-zipcode">Zipcode</label>
- <input id="user-zipcode" type="text" pattern="\d{5,5}(-\d{4,4})?" name="ZIP" maxlength="10" required placeholder="12345" size="10">
- </fieldset>
- <fieldset id="user-contact-info">
- <legend>User Contact Info</legend>
- <label for="user-email">Email</label>
- <input id="user-email" type="email" name="EMAIL" value="handy33333@aol.com" required>
- <label for="user-phone-1">Primary Phonenumber</label>
- <input id="user-phone-1" type="tel" name="PRI_PHON" maxlength="20" required placeholder="2125551212" size="20">
- <label for="user-phone-2">Secondary Phonenumber</label>
- <input id="user-phone-2" type="tel" name="SEC_PHON" maxlength="20" placeholder="2125551212" size="20">
- <label for="user-calltime">Best time to call</label>
- <select id="user-calltime" name="PREF_CALLTIME">
- <optgroup label="Primary">
- <option value="morning_primary">Morning (Primary)</option>
- <option value="afternoon_primary">Afternoon (Primary)</option>
- <option value="evening_primary">Evening (Primary)</option>
- </optgroup>
- <optgroup label="Secondary">
- <option value="morning_secondary">Morning (Secondary)</option>
- <option value="afternoon_secondary">Afternoon (Secondary)</option>
- <option value="evening_secondary">Evening (Secondary)</option>
- </optgroup>
- </select>
- </fieldset>
- <fieldset id="user-personal-info">
- <legend>User Personal Info</legend>
- <label for="veteran">Have you served in the military?</label>
- <select id="veteran" name="VA_STATUS">
- <option value="No">No</option>
- <option value="Yes">Yes</option>
- </select>
- </fieldset>
- <fieldset id="financial-info">
- <legend>User Financial Info</legend>
- <label for="verify-income">Can you verify your income?</label>
- <select id="verify-income" name="ANNUAL_VERIFIABLE_INCOME">
- <option value="YES">Yes</option>
- <option value="NO">No</option>
- </select>
- <label for="occ_stat">Occupation Status</label>
- <select id="occ_stat" name="OCC_STAT">
- <option value="employed">Employed</option>
- <option value="self_emp">Self Employed</option>
- <option value="retired">Retired</option>
- <option value="unemployed">Unemployed</option>
- </select>
- <label for="credit-grade">Credit Grade</label>
- <select id="credit-grade" name="CRED_GRADE">
- <option name="Excellent">Excellent</option>
- <option name="Good" selected>Good</option>
- <option name="Fair">Fair</option>
- <option name="Poor">Poor</option>
- </select>
- <label for="bankruptcy">Have you filed for bankruptcy</label>
- <select id="bankruptcy" name="BKCY">
- <option value="NO">No</option>
- <option value="YES">Yes</option>
- </select>
- <label for="foreclosure-bankruptcy">Have you gone through foreclosure?</label>
- <select id="foreclosure-bankruptcy" name="FHA_BANK_FORECLOSURE">
- <option value="No" selected>No</option>
- <option value="Yes">Yes</option>
- </select>
- </fieldset>
- <fieldset id="mortgage-info">
- <legend>Mortgage Info</legend>
- <label for="property-state">Property State</label>
- <input id="property-state" name="PROP_ST" required placeholder="CA" maxlength="5" size="5">
- <label for="property-zipcode">Property Zipcode</label>
- <input id="property-zipcode" name="PROP_ZIP" type="text" pattern="\d{5,5}(-\d{4,4})?" name="ZIP" maxlength="10" required placeholder="12345" size="10">
- <label for="property-type">What kind of property is this?</label>
- <select id="property-type" name="PROP_DESC">
- <option value="single_fam">Single Family Home</option>
- <option value="multi_fam">Multi Family Home</option>
- <option value="townhome">Town House</option>
- <option value="condo">Condominium</option>
- <option value="mobilehome">Mobile Home</option>
- </select>
- <label for="estimated-value">Estimated Home Value</label>
- <span class="currencyinput">$<input id="estimated-value" type="number" data-symbol="$" pattern="^\d+(?:,\d{3})*\.\d{2}$" name="EST_VAL" min="80000" max="2000001" required placeholder="450000"></span>
- <label for="mtg-balance-one">Mortgage Balance 1</label>
- <span class="currencyinput">$<input id="mtg-balance-one" type="number" pattern="^\d+(?:,\d{3})*\.\d{2}$" name="BAL_ONE" min="75000" max="2000001" required placeholder="360000"></span>
- <label for="loantype">Type of Loan</label>
- <select id="loantype" name="LOAN_TYPE">
- <option value="Fixed">Fixed</option>
- <option value="Adjustable">Adjustable</option>
- <option value="Fixed_or_Adjustable">Fixed or Adjustable</option>
- </select>
- <label for="late-payments">Have you had any late payments?</label>
- <select id="late-payments" name="NUM_MORTGAGE_LATES">
- <option value="NONE">None</option>
- </select>
- </fieldset>
- <fieldset id="agent_info">
- <legend>Agent Info</legend>
- <label for="agent_email">Agent Email</label>
- <input type="email" name="agent_email">
- </fieldset>
- <fieldset id="lead-info">
- <label for="product-label">Product</label>
- <select id="product-label" name="PRODUCT">
- <option value="PP_REFI">PP_REFI</option>
- <option value="PP_NEWHOME">PP_NEWHOME</option>
- </select>
- <label for="aid">AID</label>
- <input id="aid" name="AID" placeholder="36245" size="6">
- <label for="cid">Channel ID</label>
- <input id="cid" name="CID" onkeydown="setILI(this)" oninput="setILI(this)" onpaste="setILI(this)" placeholder="17487" size="8">
- <label for="capturetime">Time of Capture</label>
- <input type="datetime" id="capturetime" name="CAPTURE_TIME" value="08/04/2015 12:30">
- <label for="user-ipaddress">IP Address</label>
- <input id="user-ipaddress" name="IP_ADDRESS" value="209.91.148.214" placeholder="192.168.10.101">
- <label for="token">SR Token</label>
- <input id="token" name="SR_TOKEN">
- </fieldset>
- <fielset id="misc">
- <legend>Misc. details</legend>
- <label for="comments">Comments</label>
- <textarea id="comments" name="CONSUMER_COMMENTS"></textarea>
- <label for="formcert-url">Trusted Form Cert URL</label>
- <input id="formcert-url" name="XXTRUSTEDFORMCERTURL" value="https://cert.trustedform.com/62a767ef88b6d0d0b76483509084d697f9dde79c" size="128">
- <label for="extras">Extra Fields and Values (each field and value goes on its own line)</label>
- <textarea id="extras" placeholder="fieldName=someValue" onmouseoff="parseExtraFields()"></textarea>
- </fieldset>
- <button type="submit" onclick("validate()")>Submit</button>
- </form>
- <script>
- function setUserProfile(elementName){
- var profile = document.getElementById(elementName).value;
- setProfile(users(profile));
- }
- function setProfile(profile){
- setInput(profile);
- setDropdown(profile);
- }
- function setInput(profile){
- for(var key in profile){
- if(profile.hasOwnProperty(key)){
- var ele = document.getElementsByName(key)[0];
- if(ele.tagName.toLowerCase() == "input"){
- console.log(ele.tagName);
- ele.value = profile[key];
- }
- }
- }
- }
- function setDropdown(profile){
- for(var key in profile){
- if(profile.hasOwnProperty(key)){
- var ele = document.getElementsByName(key)[0];
- if(ele.tagName.toLowerCase() == "select"){
- for(var i = 0; i < ele.options.length; i++){
- if(ele.options[i].value == profile[key]){
- ele.options[i].selected = true;
- }
- }
- }
- }
- }
- }
- function setILI(channel) {
- var act = document.getElementsByTagName("form")[0];
- act.setAttribute("action","http://next-tp.leadpoint.int/"+channel.value+"/direct.ilp");
- }
- function validate() {
- var valid = true;
- var errors = "";
- if (!validateILI()) {
- errors += "CID must be set to a numeric value. ";
- valid = false;
- }
- if (!validateAID()) {
- errors += "AID must be set to a numeric value. ";
- valid = false;
- }
- if (!valid) {
- alert("The following errors occurred:"+errors);
- return false;
- }
- return true;
- }
- function validateILI() {
- var ili = document.getElementById("cid");
- if (!ili || !ili.value || isNaN(ili.value)) {
- return false;
- }
- return true;
- }
- function validateAID() {
- var aid = document.getElementById("aid");
- if (!aid || !aid.value || isNaN(aid.value)) {
- return false;
- }
- return true;
- }
- function parseExtraFields() {
- var extra = document.getElementById("extras");
- if(extra.value) {
- var parentForm = document.getElementById("formMama");
- /* Split by newlines */
- var fields = extra.value.split("\n");
- for (var i = 0; i< values.length; i++) {
- if(fields[i].value.indexOf("=") > -1){
- var keyVal = fields[i].split("=");
- var addtInput = document.createElement("input");
- addtInput.type = "hidden";
- addtInput.name = keyVal[0];
- addtInput.value = keyVal[1];
- formMama.appendChild(addtInput);
- alert("Added "+addtInput);
- }
- }
- }
- else {
- alert("Can't find Extra");
- }
- }
- function users(profile) {
- var richyRich = {
- FNAME:"Richy",
- LNAME:"Rich",
- ADDRESS:"341 E 65th St",
- CITY:"New York",
- STATE:"NY",
- ZIP:"10065",
- EMAIL:"richguy@gmail.com",
- PRI_PHON:"2123182000",
- SEC_PHON:"2123182001",
- PREF_CALLTIME:"morning_primary",
- VA_STATUS:"No",
- ANNUAL_VERIFIABLE_INCOME:"745000",
- OCC_STAT:"self_emp",
- CRED_GRADE:"Excellent",
- BKCY:"No",
- FHA_BANK_FORECLOSURE:"No",
- PROP_ST:"NY",
- PROP_ZIP:"10065",
- PROP_DESC:"multi_fam",
- EST_VAL:"750000",
- BAL_ONE:"512000",
- LOAN_TYPE:"Fixed",
- NUM_MORTGAGE_LATES:"None",
- IP_ADDRESS:"72.229.28.185"
- };
- var joeShmoe = {
- FNAME:"Joseph",
- LNAME:"Shmosby",
- ADDRESS:"1678 Newton St",
- CITY:"Akron",
- STATE:"OH",
- ZIP:"44305",
- EMAIL:"handy33333@aol.com",
- PRI_PHON:"2342053230",
- SEC_PHON:"2342050101",
- PREF_CALLTIME:"evening_primary",
- VA_STATUS:"Yes",
- ANNUAL_VERIFIABLE_INCOME:"32000",
- OCC_STAT:"employed",
- CRED_GRADE:"Good",
- BKCY:"No",
- FHA_BANK_FORECLOSURE:"No",
- PROP_ST:"OH",
- PROP_ZIP:"44305",
- PROP_DESC:"single_fam",
- EST_VAL:"160000",
- BAL_ONE:"131000",
- LOAN_TYPE:"Fixed",
- NUM_MORTGAGE_LATES:"None",
- IP_ADDRESS:"208.108.176.115"
- };
- var billHilly = {
- FNAME:"William Joseph Jemimah",
- LNAME:"Hillfordson",
- ADDRESS:"13781 S Mt Pleasant Rd. Ave",
- CITY:"Gravette",
- STATE:"AR",
- ZIP:"72751",
- EMAIL:"handy33333@aol.com",
- PRI_PHON:"4792028845",
- SEC_PHON:"4792028800",
- PREF_CALLTIME:"evening_primary",
- VA_STATUS:"No",
- ANNUAL_VERIFIABLE_INCOME:"19000",
- OCC_STAT:"unemployed",
- CRED_GRADE:"Poor",
- BKCY:"Yes",
- FHA_BANK_FORECLOSURE:"Yes",
- PROP_ST:"AR",
- PROP_ZIP:"72751",
- PROP_DESC:"single_fam",
- EST_VAL:"60000",
- BAL_ONE:"57000",
- LOAN_TYPE:"Adjustable",
- NUM_MORTGAGE_LATES:"None",
- IP_ADDRESS:"23.254.248.20"
- };
- switch(profile.toLowerCase()){
- case "poor-hillbilly":
- return billHilly;
- case "rich-brat":
- return richyRich;
- default:
- return joeShmoe;
- }
- }
- /*
- function publishers(publisher) {
- var pubChann = [
- {'Premier Mortgage', 36245, 17487},
- {'',}
- ]
- }
- */
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement