Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
6701 Zobrazení

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.

Avatar
Zrušit

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

Nejlepší odpověď

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();
}
});
```
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 24
7458
5
srp 25
9807
2
čvc 25
951
4
čvn 25
1079
1
čvn 25
1401