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

212
Views
CK Editor doesn't send data to Firebase Database Empty

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>

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Because your textarea is empty, you have to type CKEDITOR.instances.quote.updateElement(); before get element value

Updates the element that was replaced by the editor with the > current data available in the editor.

Note: This method will only affect those editor instances created with the CKEDITOR.ELEMENT_MODE_REPLACE element mode or inline instances bound to
elements.

function getdata(){
CKEDITOR.instances.quote.updateElement();
quote = document.getElementById('quote').value;
}

If it still doesn't work, you can test this block as below

 firebase.database().ref("quoteday/quotes").set({
    Data: 'Test Data',
})

and then check your database, if Test Data saved or not ?

about 4 years ago · Juan Pablo Isaza Report
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!