From 111987bdab7441d133bd64c0b092fa54313c213f Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 2 Jun 2018 10:11:32 +0200 Subject: [PATCH] Fix: old values are retrieved even when not present at page load --- manuels/static/manuels/no_book.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/manuels/static/manuels/no_book.js b/manuels/static/manuels/no_book.js index 6aaeece..fcfbf01 100644 --- a/manuels/static/manuels/no_book.js +++ b/manuels/static/manuels/no_book.js @@ -11,6 +11,14 @@ document.addEventListener("DOMContentLoaded", function (event) { }; _selector.addEventListener('change', function (event) { if (_selector.checked) { + 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, + }; document.querySelector('#id_title').value = "PAS DE LIVRE POUR CETTE CLASSE"; document.querySelector('#id_authors').value = "N/A"; document.querySelector('#id_publication_year').value = 1900;