Retrieve old values when unchecking "no book for this class".
This commit is contained in:
parent
78cb528fe7
commit
601179eba5
1 changed files with 14 additions and 6 deletions
|
@ -1,6 +1,14 @@
|
||||||
document.addEventListener("DOMContentLoaded", function (event) {
|
document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
var _selector = document.querySelector('#id_no_book');
|
var _selector = document.querySelector('#id_no_book');
|
||||||
if (_selector === null) return;
|
if (_selector === null) return;
|
||||||
|
var data = {
|
||||||
|
title: document.querySelector('#id_title').value,
|
||||||
|
authors: document.querySelector('#id_authors').value,
|
||||||
|
publicationYear: document.querySelector('#id_publication_year').value,
|
||||||
|
isbn: document.querySelector('#id_isbn').value,
|
||||||
|
price: document.querySelector('#id_price').value,
|
||||||
|
editor: document.querySelector('#id_editor').value,
|
||||||
|
};
|
||||||
_selector.addEventListener('change', function (event) {
|
_selector.addEventListener('change', function (event) {
|
||||||
if (_selector.checked) {
|
if (_selector.checked) {
|
||||||
document.querySelector('#id_title').value = "PAS DE LIVRE POUR CETTE CLASSE";
|
document.querySelector('#id_title').value = "PAS DE LIVRE POUR CETTE CLASSE";
|
||||||
|
@ -19,12 +27,12 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
}
|
}
|
||||||
document.querySelector('#id_editor').value = editorValue;
|
document.querySelector('#id_editor').value = editorValue;
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('#id_title').value = "";
|
document.querySelector('#id_title').value = data.title;
|
||||||
document.querySelector('#id_authors').value = "";
|
document.querySelector('#id_authors').value = data.authors;
|
||||||
document.querySelector('#id_editor').value = "";
|
document.querySelector('#id_editor').value = data.editor;
|
||||||
document.querySelector('#id_publication_year').value = "";
|
document.querySelector('#id_publication_year').value = data.publicationYear;
|
||||||
document.querySelector('#id_isbn').value = "";
|
document.querySelector('#id_isbn').value = data.isbn;
|
||||||
document.querySelector('#id_price').value = "";
|
document.querySelector('#id_price').value = data.price;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue