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

I don't understand, why I can't use boolean field to hide/show another field. If I try this:

<field name="my_field"

attrs="{'invisible': [('boolean_field','=','False')]}"
 />

Nothing happens. I can check boolean field and uncheck, , 'my_field' do not disappear.

But if try for example this:

<field name="my_field"

attrs="{'invisible': [('selection_field','=','2')]}"
 />

Then hide/show functionality of 'my_field' works fine. It disappears when I choose selection '2', and appears otherwise. I both selection and boolean fields from standard modules and from my modules. At both scenarios, if I use any selection field, it works, if I use boolean field, it does not.

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

You are comparing the value of boolean_field to the string 'False' which it will never be.

Do this instead:

<field name="my_field"
    attrs="{'invisible': [('boolean_field','=',False)]}"
</field>
อวตาร
ละทิ้ง
ผู้เขียน

Thanks. I don't know how I didn't see that :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
เม.ย. 19
5902
1
มี.ค. 15
4461
1
ต.ค. 22
15897
6
เม.ย. 22
42857
0
มี.ค. 24
3893