nopaque/app/static/js/forms/create-job-form.js

26 lines
835 B
JavaScript
Raw Normal View History

2023-10-05 14:08:04 +00:00
Forms.CreateJobForm = class CreateJobForm extends Forms.BaseForm {
static autoInit() {
let createJobFormElements = document.querySelectorAll('.create-job-form');
for (let createJobFormElement of createJobFormElements) {
2023-10-05 14:08:04 +00:00
new Forms.CreateJobForm(createJobFormElement);
}
}
constructor(formElement) {
super(formElement);
let versionField = this.formElement.querySelector('#create-job-form-version');
versionField.addEventListener('change', (event) => {
let url = new URL(window.location.href);
url.search = `?version=${event.target.value}`;
window.location.href = url.toString();
});
this.addEventListener('requestLoad', (event) => {
if (event.target.status === 201) {
window.location.href = event.target.getResponseHeader('Location');
}
});
}
2023-10-05 14:08:04 +00:00
};