Code Monkey home page Code Monkey logo

firebasecontact's Introduction

Firebase Contact Form

Mobile first, responsive contact from that sends data to a firebase database

firebasecontact's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebasecontact's Issues

page sends to homepage once button clicked

hi i am using your code, my problem is once the submit button is pressed it sends me back to the homepage. do you know how to get the page to stay on the contact page and not divert to different page,

thank you for the code

script using twice

i am trying to use your script on my app for creating cotact and booking form. my problem is only 1 code will work and other wont work. i changed the ids still wont work. can you please help.

i havent fully editted them for my needs. first need to work.

thank you

heres my code
booking form//
// Reference boks collection
var boksRef = firebase.database().ref('boks');

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

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

// Get values
var name = getInputVal('name');
var company = getInputVal('company');
var email = getInputVal('email');
var phone = getInputVal('phone');
var message = getInputVal('message');

// Save bok
savebok(name, company, email, phone, message);

// 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('contactForms').reset();

}

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

// Save bok to firebase
function savebok(name, company, email, phone, message){
var newbokRef = boksRef.push();
newbokRef.set({
name: name,
company:company,
email:email,
phone:phone,
message:message
});
}

//contact form
// Initialize Firebase (ADD YOUR OWN DATA)

// Reference boks collection
var bokesRef = firebase.database().ref('bokes');

// Listen for form submit
document.getElementById('contacted').addEventListener('submit', submitForms);

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

// Get values
var name = getInputVal('name');
var company = getInputVal('company');
var email = getInputVal('email');
var phone = getInputVal('phone');
var message = getInputVal('message');

// Save bok
saveboke(name, company, email, phone, message);

// 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('contacted').reset();

}

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

// Save bok to firebase
function saveboke(name, company, email, phone, message){
var newbokeRef = bokesRef.push();
newbokeRef.set({
name: name,
company:company,
email:email,
phone:phone,
message:message
});
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.