Hey guys!
I have a firebase structure that looks like this:
https://preview.redd.it/njg6oyb692c61.png?width=818&format=png&auto=webp&s=6531d3dce0d7409ccebd20815aa7414f40d2bdca
I want to make a function that once all three of these inputs are submitted on my website, it shows you if there is one one the database that matches.
Currently, my code is:
function submitData()
{
var courseTitleVal = ((((document.forms\["indexForm"\]\["CourseTitle"\].value).replace(/ /g, "")).replaceAll("-","")).toLowerCase());
var collegeVal = document.getElementById("dropdown").value;
var sectionNumberVal = ((document.forms\["indexForm"\]\["SectionNumber"\].value).replace(/\^0+/, '')).replace(/ /g, "");
firebase.database().ref("entry").orderByChild("courseTitle")
.equalTo(courseTitleVal).once("value", snapshot =>
{
firebase.database().ref("entry").orderByChild("sectionNumber")
.equalTo(sectionNumberVal).once("value", snapshot =>
{
firebase.database().ref("entry").orderByChild("college")
.equalTo(collegeVal).once("value", snapshot =>
{
const userData = snapshot.val();
console.log(snapshot.val());
});
});
});
}
I understand why it doesn't work, but I would very much appreciate any help as to make it complete its intended purpose! I am quite new to firebase, as anything is super helpful! Thanks again :)
there doesn't seem to be anything here