Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
11184 Vistas

Hi

how i can access fields values by java script ?

i tried to get language field value in java script variable, but i failed.

and i tried to know where is the function that retrieve the current language, and i failed too.

so please anyone can help me

Avatar
Descartar
Mejor respuesta
Confirm, this approach posted by Handelux worked like a charm, tested on v16
var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];

Avatar
Descartar
Mejor respuesta

User language is stored in a cookie frontend_lang so you can access it with pure javascript:

var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];
Avatar
Descartar
Mejor respuesta

The language value should be instance.session.user_context.lang.

Avatar
Descartar
Autor

please i am new in openerp. so where i can find "instance.session.user_context.lang" and how to put language in alert message

You need to read the OpenERP web module development guide. instance is sent by OpenERP to web modules during session startup.

Publicaciones relacionadas Respuestas Vistas Actividad
0
nov 21
992
0
abr 18
3385
0
sept 21
1802
1
nov 21
16151
3
may 25
1403