Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda