You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
});
}
The text was updated successfully, but these errors were encountered:
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();
}
// 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();
}
// 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
});
}
The text was updated successfully, but these errors were encountered: