Skip to Content
Menu
This question has been flagged
1 Reply
5333 Views

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

Avatar
Discard
Best Answer

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.


Avatar
Discard
Related Posts Replies Views Activity
3
Apr 24
8400
3
Mar 24
3877
1
Jan 21
2217
2
Apr 22
2978
1
Jun 23
1826