Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Duplication check of Email id in Firebase database in JavaScript

This question already has answers here: Rule entries duplicates firebase not working (1 answer) Firebase android : make username unique (3 answers) What Firebase rule will prevent duplicates in a collection based on other fields? (1 answer) Firebase unique field value (1 answer) Your post has been associated with similar questions. If these questions don’t resolve your question, ask a new one.

Closed 6 hours ago.

(Private feedback for you)

I'm completely new to firebase. I'm creating a basic contact form for my application and connected that to the firebase database. I don't have any authentication for my application. . I have set all the rules to True . I want to prevent duplication, if there exists email in database I want to display an error message.

Below is my code which I have tried

var config = {
 apiKey: "AIzaSyDA3u4bIIYHHTgB8u11NxtRVh9MOWe0jJQ",
 authDomain: "g-bb8b1.firebaseapp.com",
 databaseURL: "https://g-bb8b1-default-rtdb.firebaseio.com",
 projectId: "g-bb8b1",
 storageBucket: "g-bb8b1.appspot.com",
 messagingSenderId: "739938707423",
};
firebase.initializeApp(config);


// Reference messages collection
var messagesRef = firebase.database().ref('Email');

// Listen for form submit
document.getElementById('contactForm').addEventListener('submit', submitForm);


// Submit form
function submitForm(e){
 e.preventDefault();

 //Get value
 var email = getInputVal('email');

 // Save message
 saveMessage(email);

 // Show alert
 document.querySelector('.alert').style.display = 'block';

 // Hide alert after 3 seconds
 setTimeout(function(){
   document.querySelector('.alert').style.display = 'none';
 },3000);

 // Clear form
 document.getElementById('contactForm').reset();
}

// Function to get form value
function getInputVal(id){
 return document.getElementById(id).value;
}

// Save message to firebase
function saveMessage(email){
 var newMessageRef = messagesRef.push();
 newMessageRef.set({
   email: email
 });
}   ```

I looked for some solutions but it didn't work
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!