Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
6451 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 25
9654
3
mar 24
5264
1
ene 21
3314
2
abr 22
4086
0
ene 25
1023