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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <form id="htmlForm">
 <input name="FirstName" id="html_FirstName" maxlength="255" type="text" placeholder="First Name">
 <input name="Email" id="html_Email" maxlength="255" type="email" placeholder="Email">
 <input name="Phone" id="html_Phone" maxlength="12" type="text" placeholder="Phone">
 <fieldset>
  <legend>Choose a webinar</legend>
  <div>
   <label for="html_Letter_Date__c_0">12/1/2016</label>
   <input name="Letter_Date__c" id="html_Letter_Date__c_0" value="2016-12-01" type="radio">
  </div>
  <div>
   <label for="html_Letter_Date__c_1">12/2/2016</label>
   <input name="Letter_Date__c" id="html_Letter_Date__c_1" value="2016-12-02" type="radio">
  </div>
 </fieldset>
<fieldset>
  <legend>Next step(s)</legend>
  <div>
   <label for="html_Next_Steps__c_0">Subscribe</label>
   <input name="Next_Steps__c" id="html_Next_Steps__c_0" value="Subscribe" type="checkbox">
  </div>
  <div>
   <label for="html_Next_Steps__c_1">Call</label>
   <input name="Next_Steps__c" id="html_Next_Steps__c_1" value="Call" type="checkbox">
  </div>
 </fieldset>
<div>
	<label for="html_Rep_Age__c">I'm over 18</label>
   <input name="Rep_Age__c" id="html_Rep_Age__c" value="yes" type="checkbox">
	</div>

	<button type="submit">Submit</button>
</form>

<form id="mktoForm_787" class="mktoForm"></form>
<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>
              
            
!

CSS

              
                .mktoForm {
	/* display: none; */
	opacity: .2;
	border: 2px dotted gray;
	padding: 10px;
	margin-top: 40px;
}

#htmlForm input {
	display: block;
	margin: 5px;
	padding: 4px;
}
#htmlForm input:not([type="radio"]):not([type="checkbox"]) {
	width: 150px;
}
#htmlForm input[type="radio"],#htmlForm input[type="checkbox"] {
	height: 16px;
}
#htmlForm label {
	float: left;
	clear: left;
	height: 16px;
	margin-right: 6px;
	width: 100px;
}
#htmlForm fieldset {
	width: 140px;
	padding: 9px;
	margin: 4px;
	margin-bottom: 12px;
	border-width: 1px 1px 1px 1px !important;
}
#htmlForm input, #htmlForm fieldset {
	border: 1px solid gray;
}
#htmlForm fieldset div {
	height: 25px;
}
#htmlForm > div {
	margin-left: 13px;
}
#htmlForm * {
	font-family: monospace;
}
#htmlForm button {
	margin-top: 4px;
	margin-left: 8px;
	width: 150px;
}

              
            
!

JS

              
                var config = {
	mktoForm: {
		instanceURL: "//app-sj01.marketo.com",
		munchkinId: "410-XOR-673",
		formId: 787
	},
	htmlForm: {
		cssSelector: "#htmlForm"
	}
};

/* ---- NO NEED TO EDIT BELOW THIS LINE! ---- */

(function(config) {
	MktoForms2.loadForm(
		config.mktoForm.instanceURL,
		config.mktoForm.munchkinId,
		config.mktoForm.formId
	);
	MktoForms2.whenReady(function(mktoForm) {
		/* naive Array.from ponyfill */
		var _from = Function.prototype.call.bind(Array.prototype.slice);

		document
			.querySelector(config.htmlForm.cssSelector)
			.addEventListener("submit", function(htmlSubmitEvent) {
				var htmlFormEl = this,
					fields = {
						textLike: htmlFormEl.querySelectorAll(
							'input:not([type="radio"]):not([type="checkbox"]),textarea'
						),
						checkable: htmlFormEl.querySelectorAll(
							'input[type="radio"],input[type="checkbox"]'
						)
					},
					mktoObj = {};

				// text-like fields: just copy value
				_from(fields.textLike).forEach(function(fieldEl) {
					mktoObj[fieldEl.name] = fieldEl.value;
				});

				// checkbox, checkboxes, and radios
				// if single input w/current name, treat as Marketo checkbox type (yes/no)
				// if multiple inputs, create value array and only append if currently checked
				_from(fields.checkable).forEach(function(fieldEl) {
					
					var hasSiblingFields =
						_from(fields.checkable).some(function(siblingEl) { 
							return (siblingEl != fieldEl) && (siblingEl.name == fieldEl.name);
						});

					if (!hasSiblingFields) {
						mktoObj[fieldEl.name] = fieldEl.checked ? "yes" : "no";
					} else if (fieldEl.checked) {
						mktoObj[fieldEl.name] = mktoObj[fieldEl.name] || [];
						mktoObj[fieldEl.name].push(fieldEl.value);
					} else {
						mktoObj[fieldEl.name] = mktoObj[fieldEl.name] || null;
					}
				});

				// join any arrays with semicolons
				Object.keys(mktoObj).forEach(function(fieldName) {
					if (Array.isArray(mktoObj[fieldName])) {
						mktoObj[fieldName] = mktoObj[fieldName].join(";");
					}
				});

				// stop native HTML submit, switch to Marketo submit
				htmlSubmitEvent.preventDefault();
				mktoForm.addHiddenFields(mktoObj);
				mktoForm.submit();
			});
	});
})(config);

              
            
!
999px

Console