Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
11229 Näkymät

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

Avatar
Hylkää
Paras vastaus

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
Hylkää
Paras vastaus

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

Avatar
Hylkää
Tekijä

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.

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
marrask. 21
1016
0
huhtik. 18
3430
0
syysk. 21
1848
1
marrask. 21
16222
3
toukok. 25
1527