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

Hello!

I am trying to develop a dynamic website form. There is a selection / drop down field "type" which controls the visibility of certain other fields. 

For the backend this was easy:

 <group name="zba" string="ZBA" attrs="{'invisible':[('type', '!=','zba')]}">
                        <field name="zba_1"/>
                        <field name="zba_2"/>
                        <field name="zba_3"/>
 </group>


Unfortunately I haven't found instructions on how to archive this for the Odoo website. I tried to add


attrs="{'invisible':[('type','!=','zba')]}">


to <div>, but it doesn't work:


<div name="email_from_container" t-attf-class="form-group #{error and 'email' in error and 'has-error' or ''}" attrs="{'invisible':[('type','!=','zba')]}">

 

Is there any solution to this? Thank you.

อวตาร
ละทิ้ง

It may be achieved through the controller. look at website_sale for reference

คำตอบที่ดีที่สุด

Hello PeterN,

I think, you need to develop a javascript if you want to hide/display a field dynamically on website.

for example:

``` 
$('select').change(function()){
if ($(this).val() == 'xxx') {
$('input').hide();
}
});
```
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Odoo blog cover image not showing แก้ไขแล้ว
1
ก.ค. 24
7616
1
ก.ย. 25
232
Can't delete website แก้ไขแล้ว
5
ส.ค. 25
4812
2
ส.ค. 25
1492
2
ส.ค. 25
720