Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda