Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6498 Widoki

I have following code inside my website form:


<form id="custom_form" class="container-fluid">
    <div class="form-group row form-field o_website_form_required">
        <input type="checkbox" class="form-control o_website_form_input" name="test" required=""/>
    </div>
    <div class="form-group row">
        <div class="offset-lg-3 offset-md-4 col-md-8 col-lg-7">
            <a href="#" role="button" id="send" class="btn btn-primary btn-lg o_website_form_send">Send</a>
            <span id="o_website_form_result" class="text-danger ml8"></span>
        </div>
    </div>
</form>


But when I'm clicking save without even touching the checkbox the form ignores it and does not care if checkbox i unchecked.

But when I check it and then uncheck it again (so it should be again in its initial state) it is actually wotking and form will not pass.


What Am I doing wrong? What property is changed when I'm clicking the checkbox twice versus its initial state? It should not make a difference...


Using Odoo13

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Marcus,

you can create one Selection field and give widget Many2many Checkboxes  or you can use widget radio

demo_field = fields.Selection([('check_demo', 'Check Demo')], string='Demo')

you can also give required in python side as well as on the XML side.

<field name="demo_field" widget="many2many_checkboxes" required="1"/>

Thank you.


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 25
9702
3
mar 24
5324
1
sty 21
3381
2
kwi 22
4184
0
sty 25
1096