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

181
Vistas
How to read firestore numeric value to text field in php Javascript

I have a numeric firestore value called 1_star. What i trying to do is to retrieve the 1_star value and show it on my text field. But everytime when I want to retrieve it keep showing me error Uncaught SyntaxError: Numeric separators are not allowed at the end of numeric literal. My html text id is called star1

My code (Javascript):

db.collection("PRODUCTS").doc(pageTitle).get().then((doc) => {
    
    if (doc.exists) {
   
        document.getElementById("star1").value = doc.data().1_star;

    } else {
        // doc.data() will be undefined in this case
        console.log("No such document!");
    }
}).catch((error) => {
    console.log("Error getting document:", error);
});

My firestore value:

enter image description here

My html :

  <div class="col-sm-2">
                        <input
                          type="number"
                          class="form-control"
                          id="star1"
                          placeholder="1_Star"
                          name="star1"
                          required
                        />
                      </div>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think you are using the type text attribute for your Input field. You can solve your problem using two methods:

1- Change your input type to number.

2- Convert your data to String using toString(); function if your data type is a number:

db.collection("PRODUCTS").doc(pageTitle).get().then((doc) => {
    
    if (doc.exists) {
   
        document.getElementById("star1").value = doc.data().1_star.toString();

    } else {
        // doc.data() will be undefined in this case
        console.log("No such document!");
    }
}).catch((error) => {
    console.log("Error getting document:", error);
});

Because of you did not share your HTML code I think this might solve your problem.

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