nopaque/vre_www/website/js/job_form_handler.js
Patrick Jentsch 86557443a2 Add prototype
2019-06-03 14:57:09 +02:00

43 lines
1.3 KiB
JavaScript

function jobFormChangeHandler() {
if (jobFormFileElement.files.length === 0 || jobFormLanguageElement.value === "" || jobFormNameElement.value === "") {
jobFormSubmitElement.classList.add("disabled");
} else {
jobFormSubmitElement.classList.remove("disabled");
}
}
function jobFormSubmitHandler() {
createJob(jobFormFileElement.files[0], jobFormLanguageElement.value, jobFormNameElement.value, jobFormServiceElement.value, user["id"]);
}
var jobFormElement;
var jobFormFileElement;
var jobFormLanguageElement;
var jobFormNameElement;
var jobFormServiceElement;
var jobFormSubmitElement;
jobFormElement = document.getElementById("job_form");
jobFormFileElement = document.getElementById("job_form_file");
jobFormLanguageElement = document.getElementById("job_form_language");
jobFormNameElement = document.getElementById("job_form_name");
jobFormServiceElement = document.getElementById("job_form_service");
jobFormSubmitElement = document.getElementById("job_form_submit");
jobFormFileElement.addEventListener("change", jobFormChangeHandler);
jobFormLanguageElement.addEventListener("change", jobFormChangeHandler);
jobFormNameElement.addEventListener("input", jobFormChangeHandler);
M.Modal.init(
document.getElementById("create_job"),
{
"onCloseEnd": modal => {
jobFormElement.reset();
M.updateTextFields();
}
}
);