have created a Web Form to upload data(Rich Text) to Firebase Database,
But sometimes data is entered to Database and other Times the Fields in the Database is completely Empty. Can Anyone suggest me the solution as I am new to Web Dev.
Here is my WebForm Code (Rich Text is only in Description):
<script>
CKEDITOR.replace( 'quote' );
// Initialize Firebase
var database = firebase.database();
var quote;
function getdata(){
quote = document.getElementById('quote').value;
}
document.getElementById('submit').onclick = function(){
getdata();
firebase.database().ref("quoteday/quotes").set({
Data: quote,
})
}
document.getElementById('delete').onclick = function(){
firebase.database().ref("quoteday/").remove();
}
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!----======== CSS ======== -->
<link rel="stylesheet" href="style.css">
<script src="//cdn.ckeditor.com/4.17.2/full/ckeditor.js"></script>
</head>
<body>
<div class="form-group">
<label for="title">Quote day</label>
<textarea class="form-control" id="quote" name="quote" rows="3"
data-form-field="Message" placeholder="" autofocus=""
style="display: none;"></textarea>
</div>
<div><button id="submit">Submit/Update</button></div>
<div><button id="delete">Delete</button></div>
</body>
</html>