JavaScript
This is my JavaScript code I want to store Date value to firebase but some reason it is storing only 4 values from the form whereas I wanted to store 6
did I choose a wrong backend language for the database ?
This is my JavaScript code I want to store Date value to firebase but some reason it is storing only 4 values from the form whereas I wanted to store 6
did I choose a wrong backend language for the database ?
This is my JavaScript code I want to store Date value to firebase but some reason it is storing only 4 values from the form whereas I wanted to store 6
did I choose a wrong backend language for the database ?
This is my JavaScript code I want to store Date value to firebase but some reason it is storing only 4 values from the form whereas I wanted to store 6
did I choose a wrong backend language for the database ?
var firebaseConfig = { apiKey: "AIzaSyBM93QmsJlOUL8dfyiQdAIUxIyQvIdbuW4", authDomain: "form-a8c0e.firebaseapp.com", projectId: "form-a8c0e", storageBucket: "form-a8c0e.appspot.com", messagingSenderId: "839286832311", appId: "1:839286832311:web:3afbc112b987a15f22a132", }; // Initialize Firebase firebase.initializeApp(firebaseConfig); // Reference messages collection var messagesRef = firebase.database().ref("messages"); // Listen for form submit document.getElementById("contactForm").addEventListener("submit", submitForm); // Submit form function submitForm(e) { e.preventDefault(); // Get values var name = getInputVal("name"); var email = getInputVal("email"); var phone = getInputVal("phone"); var message = getInputVal("message"); var message = getInputVal("haircut"); var message = getInputVal("haircutTypes"); // Save message saveMessage(name, email, phone, message, haircut, haircutTypes); // Show alert document.querySelector(".alert").style.display = "block"; // Hide alert after 3 seconds setTimeout(function () { document.querySelector(".alert").style.display = "none"; }, 2500); // Clear form document.getElementById("contactForm").reset(); } // Function to get get form values function getInputVal(id) { return document.getElementById(id).value; } // Save message to firebase function saveMessage(name, email, phone, message, haircut, haircutTypes) { var newMessageRef = messagesRef.push(); newMessageRef.set({ name: name, email: email, phone: phone, message: message, haircut: haircut, haircutTypes: haircutTypes, }); }
what it is doing is storing data of haircuttype to message