×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Eric De Kock
Added: Feb 27, 2017 12:01 AM
Views: 11
  1. // SalesForce Contact Forms
  2. if (!function_exists('get_quote_form_shortcode')) {
  3.  
  4.     function get_quote_form_shortcode() {
  5.  
  6.         $theform = '<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" id="contact-form" method="POST" data-disable="false">
  7.  
  8.  <input type="hidden" name="oid" value="00D90000000JTJX" />
  9.  <input type="hidden" name="retURL" value="http://fielderscentenary.com.au/?form=success" />
  10.  <input type="hidden" name="recordType" id="recordType" value="01290000001UN6z" />
  11.  <input type="hidden" name="lead_source" value="Web" />
  12.  
  13.  
  14.  <div class="form-horizontal">
  15.    <div class="form-group">
  16.      <label for="first_name" class="col-sm-3 control-label">First Name</label>
  17.      <div class="col-sm-9">
  18.        <input  id="first_name" maxlength="40" name="first_name" class="form-control" type="text" placeholder="John (required)" required />
  19.      </div>
  20.    </div>
  21.    <div class="form-group">
  22.      <label for="last_name" class="col-sm-3 control-label">Surname</label>
  23.      <div class="col-sm-9">
  24.        <input  id="last_name" maxlength="80" name="last_name" class="form-control" type="text" placeholder="Smith (required)" required />
  25.      </div>
  26.    </div>
  27.    <div class="form-group">
  28.      <label for="email" class="col-sm-3 control-label">Email</label>
  29.      <div class="col-sm-9">
  30.        <input  id="email" maxlength="80" name="email" class="form-control" type="email" placeholder="john.smith@mail.com (required)" required />
  31.      </div>
  32.    </div>
  33.    <div class="form-group">
  34.      <label for="phone" class="col-sm-3 control-label">Phone</label>
  35.      <div class="col-sm-9">
  36.        <input  id="phone" maxlength="40" name="phone" class="form-control" type="text" placeholder="0403 000 000 (required)" required />
  37.      </div>
  38.    </div>
  39.   <div class="form-group">
  40.      <label for="street" class="col-sm-3 control-label">Address</label>
  41.      <div class="col-sm-9">
  42.        <input  id="street" maxlength="40" name="street" class="form-control" type="text" placeholder="101 Your Street (required)" required />
  43.      </div>
  44.    </div>
  45.    <div class="form-group">
  46.      <label for="city" class="col-sm-3 control-label">Suburb</label>
  47.      <div class="col-sm-9">
  48.        <input  id="city" maxlength="40" name="city" class="form-control" type="text" placeholder="Prospect (required)" required />
  49.      </div>
  50.    </div>
  51.    <div class="form-group">
  52.      <label for="state" class="col-sm-3 control-label">State</label>
  53.      <div class="col-sm-4">
  54.        <select id="state" name="state" class="form-control" required>
  55.          <option selected disabled value="">-- Select (required) --</option>
  56.            <option>ACT</option>
  57.                         <option>NSW</option>
  58.                         <option>NT</option>
  59.                         <option>QLD</option>
  60.                         <option>SA</option>
  61.                         <option>TAS</option>
  62.                         <option>VIC</option>
  63.                         <option>WA</option>
  64.        </select>
  65.      </div>
  66.      <label for="zip" class="col-sm-2 control-label">Postcode</label>
  67.      <div class="col-sm-3">
  68.        <input  id="zip" maxlength="20" name="zip" class="form-control" type="text" placeholder="5000 (required)" required />
  69.      </div>
  70.    </div>
  71.    <div class="form-group">
  72.      <label for="description" class="col-sm-3 control-label">Message</label>
  73.      <div class="col-sm-9">
  74.        <textarea name="description" rows="6" class="form-control" placeholder="Your Message..."></textarea>
  75.      </div>
  76.    </div>
  77.    <div class="form-group">
  78.      <div class="col-sm-offset-3 col-sm-9">
  79.        <div class="g-recaptcha" data-sitekey="6LdtCB4TAAAAAI8PkgHj22EAMVbBykB990lmDphy"></div>
  80.        <p class="help-text" id="recaptcha-error" style="display:none;">Please complete the CAPTCHA to provie you are human.</p>
  81.      </div>
  82.    </div>
  83.    <div class="form-group">
  84.      <div class="col-sm-offset-3 col-sm-9">
  85.        <input id="form-submit" type="submit" name="submit" class="btn btn-default" value="Send" />
  86.      </div>
  87.    </div>
  88.  
  89.  </div><!-- /.form-horizontal -->
  90.  <script>
  91.    $("#contact-form").validator().on("submit", function (e) {
  92.           var response = grecaptcha.getResponse();
  93.           //recaptcha failed validation
  94.           if(response.length == 0) {
  95.               e.preventDefault();
  96.               $("#recaptcha-error").show();
  97.           }
  98.           //recaptcha passed validation
  99.           else {
  100.               $("#recaptcha-error").hide();
  101.           }
  102.           if (e.isDefaultPrevented()) {
  103.              return false;
  104.           } else {
  105.              return true;
  106.           }
  107.    });
  108.  </script>
  109.  
  110. </form>
  111. ';
  112.  
  113.         /* $(document).ready(function() {
  114.           $("#form-submit").on("click", function(e) {
  115.           var cnt = $(".require-one:checked").length;
  116.           if (cnt < 1)
  117.           {
  118.           alert("Select at least 1 option");
  119.           e.preventDefault();
  120.           }
  121.           else
  122.           alert("Well Done!!!!");
  123.           });
  124.           })</script> */
  125.  
  126.         return $theform;
  127.     }
  128.  
  129.     add_shortcode('get_quote_form', 'get_quote_form_shortcode');
  130. }
  131.