Advertisement
Guest User

Untitled

a guest
Oct 1st, 2015
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 13.15 KB | None | 0 0
  1. <!doctype="html">
  2. <head>
  3.     <meta charset="utf-8">
  4.     <title>Lead Submission Form</title>
  5.  
  6.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  7.     <!-- Optional theme -->
  8.     <!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
  9.     <!-- Latest compiled and minified JavaScript -->
  10.     <!--script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  11.     <!-- end bootstrap -->
  12.     <style>
  13.     form {
  14.         margin:auto;
  15.         width:80%;
  16.     }
  17.     label {
  18.         clear:all;
  19.         display:block;
  20.     }
  21.     .currencyinput {
  22.         border:1px inset #ccc;
  23.     }
  24.     .currencyinput input {
  25.         border:0;
  26.         margin-left:2px;
  27.     }
  28.     input.currency:before {
  29.         content:attr(data-symbol);
  30.         float:left;
  31.         color:#aaa;
  32.     }
  33.     fieldset {
  34.         border:0;
  35.         min-width:48%;
  36.     }
  37.     textarea {
  38.         height:8em;
  39.         width:32em;
  40.     }
  41.     </style>
  42. </head>
  43. <body>
  44.  
  45.     <div id="profiles">
  46.         <select id="user-selection">
  47.             <option value="rich-brat">Richy Rich</option>
  48.             <option value="poor-hillbilly">Hill Billy</option>
  49.             <option value="average-joe">Joe Schmoe</option>
  50.         </select>
  51.         <button id="change-user" onclick="setUserProfile('user-selection')">Set User</button>
  52.     </div>
  53.     <!-- DROPDOWN to auto-fill fields with generic data -->
  54.     <form id="formMama" method="post" action="" onSubmit="validate()">
  55.         <fieldset id="user-info">
  56.             <legend>User Info</legend>
  57.             <label for="user-givenname">Firstname</label>
  58.             <input id="user-givenname" name="FNAME" required placeholder="John" size="15">
  59.  
  60.             <label for="user-surname">Lastname</label>
  61.             <input id="user-surname" name="LNAME" required placeholder="Smith" size="15">
  62.  
  63.             <label for="user-address">Address</label>
  64.             <input id="user-address" type="text" name="ADDRESS" required placeholder="123 Sesame Street">
  65.  
  66.             <label for="user-city">City</label>
  67.             <input id="user-city" name="CITY" required placeholder="Los Angeles" size="15">
  68.  
  69.             <label for="user-state">State</label>
  70.             <input id="user-state" name="STATE" required placeholder="CA" maxlength="5" size="5">
  71.  
  72.             <label for="user-zipcode">Zipcode</label>
  73.             <input id="user-zipcode" type="text" pattern="\d{5,5}(-\d{4,4})?" name="ZIP" maxlength="10" required placeholder="12345" size="10">
  74.         </fieldset>
  75.         <fieldset id="user-contact-info">
  76.             <legend>User Contact Info</legend>
  77.             <label for="user-email">Email</label>
  78.             <input id="user-email" type="email" name="EMAIL" value="handy33333@aol.com" required>
  79.  
  80.             <label for="user-phone-1">Primary Phonenumber</label>
  81.             <input id="user-phone-1" type="tel" name="PRI_PHON" maxlength="20" required placeholder="2125551212" size="20">
  82.  
  83.             <label for="user-phone-2">Secondary Phonenumber</label>
  84.             <input id="user-phone-2" type="tel" name="SEC_PHON" maxlength="20" placeholder="2125551212" size="20">
  85.  
  86.             <label for="user-calltime">Best time to call</label>
  87.             <select id="user-calltime" name="PREF_CALLTIME">
  88.                 <optgroup label="Primary">
  89.                     <option value="morning_primary">Morning (Primary)</option>
  90.                     <option value="afternoon_primary">Afternoon (Primary)</option>
  91.                     <option value="evening_primary">Evening (Primary)</option>
  92.                 </optgroup>
  93.                 <optgroup label="Secondary">
  94.                     <option value="morning_secondary">Morning (Secondary)</option>
  95.                     <option value="afternoon_secondary">Afternoon (Secondary)</option>
  96.                     <option value="evening_secondary">Evening (Secondary)</option>
  97.                 </optgroup>
  98.             </select>
  99.         </fieldset>
  100.  
  101.         <fieldset id="user-personal-info">
  102.             <legend>User Personal Info</legend>
  103.             <label for="veteran">Have you served in the military?</label>
  104.             <select id="veteran" name="VA_STATUS">
  105.                 <option value="No">No</option>
  106.                 <option value="Yes">Yes</option>
  107.             </select>
  108.         </fieldset>
  109.  
  110.         <fieldset id="financial-info">
  111.             <legend>User Financial Info</legend>
  112.             <label for="verify-income">Can you verify your income?</label>
  113.             <select id="verify-income" name="ANNUAL_VERIFIABLE_INCOME">
  114.                 <option value="YES">Yes</option>
  115.                 <option value="NO">No</option>
  116.             </select>
  117.  
  118.             <label for="occ_stat">Occupation Status</label>
  119.             <select id="occ_stat" name="OCC_STAT">
  120.                 <option value="employed">Employed</option>
  121.                 <option value="self_emp">Self Employed</option>
  122.                 <option value="retired">Retired</option>
  123.                 <option value="unemployed">Unemployed</option>
  124.             </select>
  125.  
  126.             <label for="credit-grade">Credit Grade</label>
  127.             <select id="credit-grade" name="CRED_GRADE">
  128.                 <option name="Excellent">Excellent</option>
  129.                 <option name="Good" selected>Good</option>
  130.                 <option name="Fair">Fair</option>
  131.                 <option name="Poor">Poor</option>
  132.             </select>
  133.  
  134.             <label for="bankruptcy">Have you filed for bankruptcy</label>
  135.             <select id="bankruptcy" name="BKCY">
  136.                 <option value="NO">No</option>
  137.                 <option value="YES">Yes</option>
  138.             </select>
  139.  
  140.             <label for="foreclosure-bankruptcy">Have you gone through foreclosure?</label>
  141.             <select id="foreclosure-bankruptcy" name="FHA_BANK_FORECLOSURE">
  142.                 <option value="No" selected>No</option>
  143.                 <option value="Yes">Yes</option>
  144.             </select>
  145.         </fieldset>
  146.  
  147.         <fieldset id="mortgage-info">
  148.             <legend>Mortgage Info</legend>
  149.             <label for="property-state">Property State</label>
  150.             <input id="property-state" name="PROP_ST" required placeholder="CA" maxlength="5" size="5">
  151.  
  152.             <label for="property-zipcode">Property Zipcode</label>
  153.             <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">
  154.  
  155.             <label for="property-type">What kind of property is this?</label>
  156.             <select id="property-type" name="PROP_DESC">
  157.                 <option value="single_fam">Single Family Home</option>
  158.                 <option value="multi_fam">Multi Family Home</option>
  159.                 <option value="townhome">Town House</option>
  160.                 <option value="condo">Condominium</option>
  161.                 <option value="mobilehome">Mobile Home</option>
  162.             </select>
  163.  
  164.             <label for="estimated-value">Estimated Home Value</label>
  165.             <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>
  166.  
  167.             <label for="mtg-balance-one">Mortgage Balance 1</label>
  168.             <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>
  169.             <label for="loantype">Type of Loan</label>
  170.             <select id="loantype" name="LOAN_TYPE">
  171.                 <option value="Fixed">Fixed</option>
  172.                 <option value="Adjustable">Adjustable</option>
  173.                 <option value="Fixed_or_Adjustable">Fixed or Adjustable</option>
  174.             </select>
  175.             <label for="late-payments">Have you had any late payments?</label>
  176.             <select id="late-payments" name="NUM_MORTGAGE_LATES">
  177.                 <option value="NONE">None</option>
  178.             </select>
  179.         </fieldset>
  180.         <fieldset id="agent_info">
  181.             <legend>Agent Info</legend>
  182.             <label for="agent_email">Agent Email</label>
  183.             <input type="email" name="agent_email">
  184.  
  185.         </fieldset>
  186.         <fieldset id="lead-info">
  187.             <label for="product-label">Product</label>
  188.             <select id="product-label" name="PRODUCT">
  189.                 <option value="PP_REFI">PP_REFI</option>
  190.                 <option value="PP_NEWHOME">PP_NEWHOME</option>
  191.             </select>
  192.  
  193.             <label for="aid">AID</label>
  194.             <input id="aid" name="AID" placeholder="36245" size="6">
  195.  
  196.             <label for="cid">Channel ID</label>
  197.             <input id="cid" name="CID" onkeydown="setILI(this)" oninput="setILI(this)" onpaste="setILI(this)" placeholder="17487" size="8">
  198.  
  199.             <label for="capturetime">Time of Capture</label>
  200.             <input type="datetime" id="capturetime" name="CAPTURE_TIME" value="08/04/2015 12:30">
  201.  
  202.             <label for="user-ipaddress">IP Address</label>
  203.             <input id="user-ipaddress" name="IP_ADDRESS" value="209.91.148.214" placeholder="192.168.10.101">
  204.  
  205.             <label for="token">SR Token</label>
  206.             <input id="token" name="SR_TOKEN">
  207.         </fieldset>
  208.  
  209.         <fielset id="misc">
  210.             <legend>Misc. details</legend>
  211.             <label for="comments">Comments</label>
  212.             <textarea id="comments" name="CONSUMER_COMMENTS"></textarea>
  213.  
  214.             <label for="formcert-url">Trusted Form Cert URL</label>
  215.             <input id="formcert-url" name="XXTRUSTEDFORMCERTURL" value="https://cert.trustedform.com/62a767ef88b6d0d0b76483509084d697f9dde79c" size="128">
  216.  
  217.             <label for="extras">Extra Fields and Values (each field and value goes on its own line)</label>
  218.             <textarea id="extras" placeholder="fieldName=someValue" onmouseoff="parseExtraFields()"></textarea>
  219.         </fieldset>
  220.         <button type="submit" onclick("validate()")>Submit</button>
  221.     </form>
  222.     <script>
  223.     function setUserProfile(elementName){
  224.         var profile = document.getElementById(elementName).value;
  225.         setProfile(users(profile));
  226.     }
  227.     function setProfile(profile){
  228.         setInput(profile);
  229.         setDropdown(profile);
  230.     }
  231.     function setInput(profile){
  232.         for(var key in profile){
  233.             if(profile.hasOwnProperty(key)){
  234.                 var ele = document.getElementsByName(key)[0];
  235.                 if(ele.tagName.toLowerCase() == "input"){
  236.                     console.log(ele.tagName);
  237.                     ele.value = profile[key];
  238.                 }
  239.             }
  240.         }
  241.  
  242.     }
  243.     function setDropdown(profile){
  244.         for(var key in profile){
  245.             if(profile.hasOwnProperty(key)){
  246.                 var ele = document.getElementsByName(key)[0];
  247.                 if(ele.tagName.toLowerCase() == "select"){
  248.                     for(var i = 0; i < ele.options.length; i++){
  249.                         if(ele.options[i].value == profile[key]){
  250.                             ele.options[i].selected = true;
  251.                         }
  252.                     }
  253.                 }
  254.             }
  255.         }
  256.  
  257.     }
  258.     function setILI(channel) {
  259.         var act = document.getElementsByTagName("form")[0];
  260.         act.setAttribute("action","http://next-tp.leadpoint.int/"+channel.value+"/direct.ilp");
  261.     }
  262.     function validate() {
  263.         var valid = true;
  264.         var errors = "";
  265.         if (!validateILI()) {
  266.             errors += "CID must be set to a numeric value. ";
  267.             valid = false;
  268.         }
  269.         if (!validateAID()) {
  270.             errors += "AID must be set to a numeric value. ";
  271.             valid = false;
  272.         }
  273.         if (!valid) {
  274.             alert("The following errors occurred:"+errors);
  275.             return false;
  276.         }
  277.         return true;
  278.     }
  279.     function validateILI() {
  280.         var ili = document.getElementById("cid");
  281.         if (!ili || !ili.value || isNaN(ili.value)) {
  282.             return false;
  283.         }
  284.         return true;
  285.     }
  286.     function validateAID() {
  287.         var aid = document.getElementById("aid");
  288.         if (!aid || !aid.value || isNaN(aid.value)) {
  289.             return false;
  290.         }
  291.         return true;
  292.     }
  293.     function parseExtraFields() {
  294.         var extra = document.getElementById("extras");
  295.         if(extra.value) {
  296.             var parentForm = document.getElementById("formMama");
  297.             /* Split by newlines */
  298.             var fields = extra.value.split("\n");
  299.             for (var i = 0; i< values.length; i++) {
  300.                 if(fields[i].value.indexOf("=") > -1){
  301.                     var keyVal      = fields[i].split("=");
  302.                     var addtInput   = document.createElement("input");
  303.  
  304.                     addtInput.type  = "hidden";
  305.                     addtInput.name  = keyVal[0];
  306.                     addtInput.value = keyVal[1];
  307.                     formMama.appendChild(addtInput);
  308.                     alert("Added "+addtInput);
  309.                 }
  310.             }
  311.         }
  312.         else {
  313.             alert("Can't find Extra");
  314.         }
  315.     }
  316.     function users(profile) {
  317.         var richyRich = {
  318.             FNAME:"Richy",
  319.             LNAME:"Rich",
  320.             ADDRESS:"341 E 65th St",
  321.             CITY:"New York",
  322.             STATE:"NY",
  323.             ZIP:"10065",
  324.             EMAIL:"richguy@gmail.com",
  325.             PRI_PHON:"2123182000",
  326.             SEC_PHON:"2123182001",
  327.             PREF_CALLTIME:"morning_primary",
  328.             VA_STATUS:"No",
  329.             ANNUAL_VERIFIABLE_INCOME:"745000",
  330.             OCC_STAT:"self_emp",
  331.             CRED_GRADE:"Excellent",
  332.             BKCY:"No",
  333.             FHA_BANK_FORECLOSURE:"No",
  334.             PROP_ST:"NY",
  335.             PROP_ZIP:"10065",
  336.             PROP_DESC:"multi_fam",
  337.             EST_VAL:"750000",
  338.             BAL_ONE:"512000",
  339.             LOAN_TYPE:"Fixed",
  340.             NUM_MORTGAGE_LATES:"None",
  341.             IP_ADDRESS:"72.229.28.185"
  342.         };
  343.         var joeShmoe = {
  344.             FNAME:"Joseph",
  345.             LNAME:"Shmosby",
  346.             ADDRESS:"1678 Newton St",
  347.             CITY:"Akron",
  348.             STATE:"OH",
  349.             ZIP:"44305",
  350.             EMAIL:"handy33333@aol.com",
  351.             PRI_PHON:"2342053230",
  352.             SEC_PHON:"2342050101",
  353.             PREF_CALLTIME:"evening_primary",
  354.             VA_STATUS:"Yes",
  355.             ANNUAL_VERIFIABLE_INCOME:"32000",
  356.             OCC_STAT:"employed",
  357.             CRED_GRADE:"Good",
  358.             BKCY:"No",
  359.             FHA_BANK_FORECLOSURE:"No",
  360.             PROP_ST:"OH",
  361.             PROP_ZIP:"44305",
  362.             PROP_DESC:"single_fam",
  363.             EST_VAL:"160000",
  364.             BAL_ONE:"131000",
  365.             LOAN_TYPE:"Fixed",
  366.             NUM_MORTGAGE_LATES:"None",
  367.             IP_ADDRESS:"208.108.176.115"
  368.         };
  369.         var billHilly = {
  370.             FNAME:"William Joseph Jemimah",
  371.             LNAME:"Hillfordson",
  372.             ADDRESS:"13781 S Mt Pleasant Rd. Ave",
  373.             CITY:"Gravette",
  374.             STATE:"AR",
  375.             ZIP:"72751",
  376.             EMAIL:"handy33333@aol.com",
  377.             PRI_PHON:"4792028845",
  378.             SEC_PHON:"4792028800",
  379.             PREF_CALLTIME:"evening_primary",
  380.             VA_STATUS:"No",
  381.             ANNUAL_VERIFIABLE_INCOME:"19000",
  382.             OCC_STAT:"unemployed",
  383.             CRED_GRADE:"Poor",
  384.             BKCY:"Yes",
  385.             FHA_BANK_FORECLOSURE:"Yes",
  386.             PROP_ST:"AR",
  387.             PROP_ZIP:"72751",
  388.             PROP_DESC:"single_fam",
  389.             EST_VAL:"60000",
  390.             BAL_ONE:"57000",
  391.             LOAN_TYPE:"Adjustable",
  392.             NUM_MORTGAGE_LATES:"None",
  393.             IP_ADDRESS:"23.254.248.20"
  394.         };
  395.  
  396.         switch(profile.toLowerCase()){
  397.             case "poor-hillbilly":
  398.                 return billHilly;
  399.             case "rich-brat":
  400.                 return richyRich;
  401.             default:
  402.                 return joeShmoe;
  403.         }
  404.     }
  405.     /*
  406.     function publishers(publisher) {
  407.         var pubChann = [
  408.             {'Premier Mortgage', 36245, 17487},
  409.             {'',}
  410.         ]
  411.     }
  412.     */
  413.     </script>
  414. </body>
  415. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement