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

              
                <script>MktoForms2.loadForm("//app-sj01.marketo.com", "410-XOR-673", 369);</script>
<form id="mktoForm_369">
</form>

              
            
!

CSS

              
                .mktoForm {
	margin: 20px;
	padding: 20px;
	border: 1px solid gray;
	border-radius: 6px;
	background-color: beige;
}

INPUT[type="checkbox"] + .mktoError {
	right: auto !important;
	margin-left: -8px !important;
}

fieldset.mktoFormCol {
	border: 1px solid #ccc;
	background-color: aliceblue !important;
	border-radius: 6px;
}

fieldset.mktoFormCol LEGEND {
	background-color: aliceblue;
	padding: 4px 9px;
	border: 1px solid #ccc;
	position: relative;
	top: -3px;
	border-radius: 3px;
}
              
            
!

JS

              
                // ---- config section - site-specific setup here ----
// array of checkbox groups, each group defined by an array of fields
// maxChecked is (obvs.) the max # of elements that can be checked at once
var checkboxGroups = [
	{
		fieldNames: ["IsTestContact__c", "Email_was_deleted__c", "ContactReq__c"],
		minChecked: 1,
		maxChecked: 2,
		minMessage: "You must check at least one box in this group!"
	}
];

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

MktoForms2.whenReady(function(form) {
	var formEl = form.getFormElem()[0],
		arrayify = getSelection.call.bind([].slice);

	// in real-time, when the max checked is reached, disable remaining 'boxes in the group
	checkboxGroups.forEach(function(group) {
		var groupEls = formEl.querySelectorAll("#" + group.fieldNames.join(",#"));
		arrayify(groupEls).forEach(function(el) {
			el.addEventListener("click", function(e) {
				var numChecked = arrayify(groupEls).filter(function(itm) {
					return itm.checked;
				}).length;
				arrayify(groupEls).forEach(function(el) {
					el.disabled = numChecked == group.maxChecked && !el.checked;
				});
			});
		});
	});

	// check minimum during validation
	form.onValidate(function(nativeValid) {
		if (!nativeValid) return;

		checkboxGroups.forEach( function(group) {
			form.submittable(false);
			var groupEls = formEl.querySelectorAll("#" + group.fieldNames.join(",#")),
				numChecked = arrayify(groupEls).filter(function(itm) {
					return itm.checked;
				}).length;
			if (numChecked < group.minChecked) {
				form.showErrorMessage(
					group.minMessage,
					MktoForms2.$(groupEls[groupEls.length - 1])
				);
			} else {
				form.submittable(true);
			}
		});
	});
});

              
            
!
999px

Console