<commit_before>;
(function() {
	window.experimentForm = {
		init: function(parametersUrl, parameterPrefixesUrl, experimentsListUrl) {
            // update parameter formset each time a different algorithm is selected
			$('.algorithm-selection select').change(function() {
				$.ajax({
					url: parametersUrl,
					data: {
						algorithm_id: $(this).val(),
						prefix: $(this).attr('name')
					},
					context: $(this)
				}).done(function(resp) {

					var formWindow = $(this).closest('.task').parent();
					formWindow.find(".parameter-values").html(resp);
					window.taskBoxes.handleAlgorithmChange(formWindow);
				});
			});

            // refresh form data before submition
            // recreate modal windows in case of validation errors
			$('#execute-btn').click(function(ev) {
                // pass current task forms prefixes to obtain parameter
                // formsets prefixes
				var names = []
				$.each($(".task-window .task-form"), function(idx, taskForm) {
					var name = $(taskForm).find("input,select,textarea,label").attr("name");
					names.push(name);
				});
				$.ajax({
					url: parameterPrefixesUrl,
					data: {
						prefixes: names
					},
					context: $(this)
				}).done(function(formsetPrefixes) {
					// update parameter formsets prefixes
					var prefixes = formsetPrefixes.split(",");
					$.each($(".task-window .parameter-values"), function(formIdx, params) {
						console.log(formIdx, prefixes[formIdx]);
						$.each($(params).find("input, select, textarea, label"), function(inputIdx, input) {
							var newName = $(input).attr("name");
							newName = newName.replace(/PV_\d+/, prefixes[formIdx]);
							$(input).attr("name", newName);
						});
					});

					var form = $("#experiment-form");
					var data = form.serialize();
					console.log(data);
					$.post("/x/experiment-formset/", data, function(resp) {
						if (resp === "OK") {
							window.location = experimentsListUrl;
							return;
						}
						$("#experiment-form").remove();
						$("#workflow-editor-container").before(resp);
						// TODO: re-creation of modal windows
					});
				});
			});
		},
	}
})();
<commit_msg>Posting experiment form to url in form action attribute.<commit_after>;
(function() {
	window.experimentForm = {
		init: function(parametersUrl, parameterPrefixesUrl, experimentsListUrl) {
            // update parameter formset each time a different algorithm is selected
			$('.algorithm-selection select').change(function() {
				$.ajax({
					url: parametersUrl,
					data: {
						algorithm_id: $(this).val(),
						prefix: $(this).attr('name')
					},
					context: $(this)
				}).done(function(resp) {

					var formWindow = $(this).closest('.task').parent();
					formWindow.find(".parameter-values").html(resp);
					window.taskBoxes.handleAlgorithmChange(formWindow);
				});
			});

            // refresh form data before submition
            // recreate modal windows in case of validation errors
			$('#execute-btn').click(function(ev) {
                // pass current task forms prefixes to obtain parameter
                // formsets prefixes
				var names = []
				$.each($(".task-window .task-form"), function(idx, taskForm) {
					var name = $(taskForm).find("input,select,textarea,label").attr("name");
					names.push(name);
				});
				$.ajax({
					url: parameterPrefixesUrl,
					data: {
						prefixes: names
					},
					context: $(this)
				}).done(function(formsetPrefixes) {
					// update parameter formsets prefixes
					var prefixes = formsetPrefixes.split(",");
					$.each($(".task-window .parameter-values"), function(formIdx, params) {
						console.log(formIdx, prefixes[formIdx]);
						$.each($(params).find("input, select, textarea, label"), function(inputIdx, input) {
							var newName = $(input).attr("name");
							newName = newName.replace(/PV_\d+/, prefixes[formIdx]);
							$(input).attr("name", newName);
						});
					});

					var form = $("#experiment-form");
					var data = form.serialize();
					console.log(data);
					$.post(form.attr("action"), data, function(resp) {
						if (resp === "OK") {
							window.location = experimentsListUrl;
							return;
						}
						$("#experiment-form").remove();
						$("#workflow-editor-container").before(resp);
						// TODO: re-creation of modal windows
					});
				});
			});
		},
	}
})();

{'fraction_non_alphanumeric': 0.1706422018348624, 'fraction_numerical': 0.0, 'mean_word_length': 2.7114893617021276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3383433', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1240, 'n_words': 264}