<commit_before><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery accordion form with validation</title>

<script src="../../lib/jquery.js"></script>
<script src="../../dist/jquery.validate.js"></script>

<script src="../marketo/jquery.maskedinput.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

	$("#recordClientPhone").mask("(999) 999-9999");
	$("#recordClientPhoneAlt").mask("(999) 999-9999");
	$("#recordClientZip").mask("99999");
	$("#recordPropertyZip").mask("99999");
	$("#recordPurchaseZip").mask("99999");

	// add * to required field labels
	$('label.required').append('&nbsp;<strong>*</strong>&nbsp;');

	// accordion functions
	var accordion = $("#stepForm").accordion();
	var current = 0;

	$.validator.addMethod("pageRequired", function(value, element) {
		var $element = $(element)
		function match(index) {
			return current == index && $(element).parents("#sf" + (index + 1)).length;
		}
		if (match(0) || match(1) || match(2)) {
			return !this.optional(element);
		}
		return "dependency-mismatch";
	}, $.validator.messages.required)

	var v = $("#cmaForm").validate({
		errorClass: "warning",
		onkeyup: false,
		onblur: false,
		submitHandler: function() {
			alert("Submitted, thanks!");
		}
	});

	// back buttons do not need to run validation
	$("#sf2 .prevbutton").click(function(){
		accordion.accordion("option", "active", 0);
		current = 0;
	});
	$("#sf3 .prevbutton").click(function(){
		accordion.accordion("option", "active", 1);
		current = 1;
	});
	// these buttons all run the validation, overridden by specific targets above
	$(".open2").click(function() {
	  if (v.form()) {
	    accordion.accordion("option", "active", 2);
	    current = 2;
	  }
	});
	$(".open1").click(function() {
	  if (v.form()) {
	    accordion.accordion("option", "active", 1);<commit_msg>Demo: Use correct option in multipart demo.<commit_after><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery accordion form with validation</title>

<script src="../../lib/jquery.js"></script>
<script src="../../dist/jquery.validate.js"></script>

<script src="../marketo/jquery.maskedinput.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

	$("#recordClientPhone").mask("(999) 999-9999");
	$("#recordClientPhoneAlt").mask("(999) 999-9999");
	$("#recordClientZip").mask("99999");
	$("#recordPropertyZip").mask("99999");
	$("#recordPurchaseZip").mask("99999");

	// add * to required field labels
	$('label.required').append('&nbsp;<strong>*</strong>&nbsp;');

	// accordion functions
	var accordion = $("#stepForm").accordion();
	var current = 0;

	$.validator.addMethod("pageRequired", function(value, element) {
		var $element = $(element)
		function match(index) {
			return current == index && $(element).parents("#sf" + (index + 1)).length;
		}
		if (match(0) || match(1) || match(2)) {
			return !this.optional(element);
		}
		return "dependency-mismatch";
	}, $.validator.messages.required)

	var v = $("#cmaForm").validate({
		errorClass: "warning",
		onkeyup: false,
		onfocusout: false,
		submitHandler: function() {
			alert("Submitted, thanks!");
		}
	});

	// back buttons do not need to run validation
	$("#sf2 .prevbutton").click(function(){
		accordion.accordion("option", "active", 0);
		current = 0;
	});
	$("#sf3 .prevbutton").click(function(){
		accordion.accordion("option", "active", 1);
		current = 1;
	});
	// these buttons all run the validation, overridden by specific targets above
	$(".open2").click(function() {
	  if (v.form()) {
	    accordion.accordion("option", "active", 2);
	    current = 2;
	  }
	});
	$(".open1").click(function() {
	  if (v.form()) {
	    accordion.accordion("option", "active", 1);
{'fraction_non_alphanumeric': 0.22302158273381295, 'fraction_numerical': 0.02877697841726619, 'mean_word_length': 4.625722543352601, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3917397', 'n_tokens_mistral': 1428, 'n_tokens_neox': 1273, 'n_words': 259}