Improve editor selection in "no book" case. #4
This commit is contained in:
parent
ddd1043113
commit
f21f8a8ac9
1 changed files with 10 additions and 1 deletions
|
@ -4,10 +4,19 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
|||
if (_selector.checked) {
|
||||
document.querySelector('#id_title').value = "PAS DE LIVRE POUR CETTE CLASSE";
|
||||
document.querySelector('#id_authors').value = "N/A";
|
||||
document.querySelector('#id_editor').value = 1;
|
||||
document.querySelector('#id_publication_year').value = 1900;
|
||||
document.querySelector('#id_isbn').value = "0000000000";
|
||||
document.querySelector('#id_price').value = 0;
|
||||
var editorValue = null;
|
||||
for (var option of document.querySelector('#id_editor').children) {
|
||||
if (editorValue === null && option.value !== "") {
|
||||
editorValue = option.value;
|
||||
}
|
||||
if (option.firstChild.data.toLowerCase().indexOf('autre') !== -1) {
|
||||
editorValue = option.value;
|
||||
}
|
||||
}
|
||||
document.querySelector('#id_editor').value = editorValue;
|
||||
} else {
|
||||
document.querySelector('#id_title').value = "";
|
||||
document.querySelector('#id_authors').value = "";
|
||||
|
|
Loading…
Reference in a new issue