Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
11249 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
Confirm, this approach posted by Handelux worked like a charm, tested on v16
var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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];
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 21
1045
0
เม.ย. 18
3436
0
ก.ย. 21
1855
1
พ.ย. 21
16244
3
พ.ค. 25
1575