mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-16 01:35:41 +00:00
26 lines
796 B
JavaScript
26 lines
796 B
JavaScript
|
class CreateJobForm extends Form {
|
||
|
static autoInit() {
|
||
|
let createJobFormElements = document.querySelectorAll('.create-job-form');
|
||
|
for (let createJobFormElement of createJobFormElements) {
|
||
|
new 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');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|