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

227
Vistas
Odoo 14 Change value of input in Javascript

I am calling an api from python that returns json to the javascript function. When returning the data I am setting the value of an input field using jquery. But when saving theform the field value is not being saved. What's the solution? Thanks in advance.

$.each(data['payload'], function(key, val) {
    let el = $('[name='+key+']');
    el.val(val);
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Sometimes websites use form fields only as "frontend" for some internal state that gets synced whenever the data in the field changes.

When a user changes the contents of the field, a change event is fired. This won't happen if you programmatically change the value though, so such a change would not be picked up by code listening for changes.

To fix this problem, you can manually trigger a change event on the field after modifying its value. You seem to be using jQuery, there you can simply use the change() method like this:

el.val(val).change()
           ^^^^^^^^^
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