Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>

<head>
  <meta title="submit form example">
</head>

<body>
  LeadBoxer example capture form details<br><br>
  <form name="myform" method="post" action="">
    <label> email: </label>
    <input name="textbox" type="text" id="email" value="" /><br>
    <label> company: </label>
    <input name="textbox" type="text" id="company" /><br>
    <label> first name: </label>
    <input name="textbox" type="text" id="firstName" /><br>
    <label> last name: </label>
    <input name="textbox" type="text" id="lastName" /><br>
    <label> phone number: </label>
    <input name="textbox" type="text" id="phoneNumber" /><br><br>

    <input type="button" name="submitForm" id="submitForm" value="Click to submit form" onclick="sendTextForm()" />

  </form>
<br>
  We advise to developer tools /console in your browser to see what happens 'under the hood'

  <!-- Load the LeadBoxer javascript first -->

</body>

</html>
              
            
!

CSS

              
                html {
  font-family: arial;
}

              
            
!

JS

              
                function sendTextForm() {
  // create a new LeadBoxer events object called "map"
  var map = new OTMap();

  // fill the map objects with values
  // with getElementById you can get the data from all the form events
  var emailTextbox = document.getElementById("email").value;
  var companyTextbox = document.getElementById("company").value;
  var firstNameTextbox = document.getElementById("firstName").value;
  var lastNameTextbox = document.getElementById("lastName").value;
  var phoneNoTextbox = document.getElementById("phoneNumber").value;

  // add the form field to the map
  map.put("email", emailTextbox);
  map.put("companyName", companyTextbox);
  map.put("firstName", firstNameTextbox);
  map.put("lastName", lastNameTextbox);
  map.put("phoneNumber", phoneNoTextbox);

  // send the data
  OTLogService.sendEvent("Contact demo form submitted", map);

  // in order to make sure the data is transmitted before we proceed to a thankyou page we recommend a small delay of 500 ms before the form is actually submitted. 
  setTimeout(function() {
    document.myform.submit();
  }, 500);
}
              
            
!
999px

Console