From 302af4bbd53ef24d173779ced8715c89c14f7658 Mon Sep 17 00:00:00 2001 From: Kara Hoagland Date: Sun, 20 Nov 2022 14:36:03 -0800 Subject: [PATCH 1/2] tempIfElseAlert --- source/assets/scripts/CreatePage.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/source/assets/scripts/CreatePage.js b/source/assets/scripts/CreatePage.js index af666c7..f8620d4 100644 --- a/source/assets/scripts/CreatePage.js +++ b/source/assets/scripts/CreatePage.js @@ -31,18 +31,22 @@ function initFormHandler() { reviewObject[`${key}`] = `${value}`; } } - reviewObject["tags"] = []; + if(reviewObject["rating"] != null){ + reviewObject["tags"] = []; - let tags = document.querySelectorAll(".tag"); - for(let i = 0; i < tags.length; i ++) { - reviewObject["tags"].push(tags[i].innerHTML); - tagContainer.removeChild(tags[i]); + let tags = document.querySelectorAll(".tag"); + for(let i = 0; i < tags.length; i ++) { + reviewObject["tags"].push(tags[i].innerHTML); + tagContainer.removeChild(tags[i]); + } + + let nextReviewId = newReviewToStorage(reviewObject); + sessionStorage.setItem("currID", JSON.stringify(nextReviewId)); + + window.location.assign("./ReviewDetails.html"); + } else{ + window.alert("NO"); } - - let nextReviewId = newReviewToStorage(reviewObject); - sessionStorage.setItem("currID", JSON.stringify(nextReviewId)); - - window.location.assign("./ReviewDetails.html"); }); From 250617776b5ab9996ac1ad5cf2496b9798986403 Mon Sep 17 00:00:00 2001 From: Kara Hoagland Date: Sun, 20 Nov 2022 14:47:26 -0800 Subject: [PATCH 2/2] more details --- source/assets/scripts/CreatePage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/assets/scripts/CreatePage.js b/source/assets/scripts/CreatePage.js index f8620d4..51d2956 100644 --- a/source/assets/scripts/CreatePage.js +++ b/source/assets/scripts/CreatePage.js @@ -45,7 +45,7 @@ function initFormHandler() { window.location.assign("./ReviewDetails.html"); } else{ - window.alert("NO"); + window.alert("NO! FILL IN STARS"); } });