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

249
Vistas
How do capture a value from an input field, that was fed in from the `localStorage`?

How do capture a value from an input field, that was fed in from the localStorage?

My localStorage.getItem("PatientsName"); yeilds: "Vincent Ericsson"

I feed this value into my input field like this:

document.getElementById("Names").innerHTML = localStorage.getItem("PatientsName");

Below, in the browser console, is what my input group looks like in code:

<form action="/" class="form" method="post">
   <div class="input-group mb-3">
      <input type="text" class="form-control" id="Names" name="names">Vincent Ericsson</input>
   </div>
   
   <button type="submit" class="btn btn-secondary" id="submit">Submit</button>

</form

...and suprisingly, below is what the browser renders, which is an empty input field: an empty input field

I dont understand why the value Vincent Ericsson reflect only in the code, but is NOT rendered in the input field...

The environment I am developing this is Nodejs, so when I try to capture the value from the input field in code:

app.route('/')
   .get((req, res) =>{
      res.render('index');
})

   .post((req, res) => {
      console.log("You POSTED!");
      let userName = req.body;
      console.log("Names: " ,userName);
});

In the Terminal, the code above yeilds what you see below:

You POSTED!
Names: {
  name: '',
  
}

My question here is how do I successfully capture the value in the input field, in this instance Vincent Ericsson?

Looking forward to your help.

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