Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
11198 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
Confirm, this approach posted by Handelux worked like a charm, tested on v16
var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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];
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 21
995
0
thg 4 18
3394
0
thg 9 21
1825
1
thg 11 21
16180
3
thg 5 25
1449