Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
11399 Visualizzazioni

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
Abbandona
Risposta migliore
Confirm, this approach posted by Handelux worked like a charm, tested on v16
var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];

Avatar
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

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

Avatar
Abbandona
Autore

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.

Post correlati Risposte Visualizzazioni Attività
0
nov 21
1116
0
apr 18
3537
0
set 21
1947
1
nov 21
16383
3
mag 25
1898