firebasecontact icon indicating copy to clipboard operation
firebasecontact copied to clipboard

page sends to homepage once button clicked

Open daisys77 opened this issue 6 years ago • 4 comments

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

daisys77 avatar Apr 03 '18 19:04 daisys77

Hi, you might be missing preventDefault(), thus it redirect to different page

i can check the issue if you show me code on codepen, jsfiddle, jsbin or whatever

Datikzz avatar Apr 03 '18 20:04 Datikzz

https://codepen.io/taz23212/pen/jzpGep

Hi uploaded the code. Can you please check. I have another big problem I am trying to create a app now my login and register pages stop functioning for some reason I only added your codes. Can I give my whole code it jQuery one page.html can you please check I can not the login and signup pages working.

Thank you for helping Kaz

daisys77 avatar Apr 03 '18 21:04 daisys77

apparently you didn't initialize "firebase", console is warning with this

ReferenceError: Can't find variable: firebase

you are missing these, author did mention to add your own data

// Initialize Firebase (ADD YOUR OWN DATA)
var config = {
  apiKey: "xxxxx",
  authDomain: "xxxxx",
  databaseURL: "xxxxx",
  projectId: "xxxxx",
  storageBucket: "xxxxx",
  messagingSenderId: "xxxxx"
};
firebase.initializeApp(config);

and put this before the closing

tag <script src="https://www.gstatic.com/firebasejs/4.3.0/firebase.js"></script>

Datikzz avatar Apr 04 '18 09:04 Datikzz

Hi thats not the problem my main.js does have that script. I cannot seem to stop the page diverting elsewhere. Thank you

// Initialize Firebase (ADD YOUR OWN DATA) edited version var config = { apiKey: "AJc00", authDomain: "autcom", databaseURL: "htteio.comhttp://htteio.com", projectId: "auto-mechanics", storageBucket: "au, messagingSenderId: "86785554" }; firebase.initializeApp(config);

// Reference messages collection CONTACT PAGE var contactRef = firebase.database().ref('contact');

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

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

On 4 Apr 2018, at 10:50, Datikzz <[email protected]mailto:[email protected]> wrote:

apparently you didn't initialize "firebase", console is warning with this

ReferenceError: Can't find variable: firebase

you are missing these, author did mention to add your own data // Initialize Firebase (ADD YOUR OWN DATA) var config = { apiKey: "xxxxx", authDomain: "xxxxx", databaseURL: "xxxxx", projectId: "xxxxx", storageBucket: "xxxxx", messagingSenderId: "xxxxx" }; firebase.initializeApp(config);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/bradtraversy/firebasecontact/issues/2#issuecomment-378544489, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AV1fmItbnA9RrM4lKjYFrN_ztYcfd8TQks5tlJdWgaJpZM4TFnN_.

daisys77 avatar Apr 04 '18 14:04 daisys77