-
- Downloads
[FIX] website: prevent validation of conditionally hidden fields
Steps to reproduce the issue (see opw):
- Add a form to a page
- Add a checkbox
- Add a second checkbox that is required and visible only if the first
checkbox is not checked
- Save
- Do not check anything and try to send => Good, you can't, the required
checkbox is not set
- Check the second checkbox and try to send => Good, you can, the
required checkbox is set
- Go back to the empty form, check the first checkbox and try to send
=> Bad, you can't but you should: the required checkbox is hidden, it
is not supposed to be required anymore.
(Not that arguably, that two checkboxes setup should be replaced by a
required selection field but the issue of the OPW would remain as there
is another required conditionally-hidden field (a file upload) when the
second checkbox is checked.)
Conditionally-hidden fields should not require validation while they are
hidden. Indeed, their purpose is to be able to enter additional data
when some condition is fulfilled. If such a field is required, it is
only required when visible. The problem only occurred with checkboxes,
the other fields were already working in that case. Although there could
be issues with dates too, this commit added a series of FIXME and TODO
comments as well as some things need to be investigated.
opw-3003952
closes odoo/odoo#105870
Signed-off-by:
Romain Derie (rde) <rde@odoo.com>
Showing
- addons/website/static/src/snippets/s_website_form/000.js 25 additions, 2 deletionsaddons/website/static/src/snippets/s_website_form/000.js
- addons/website/static/tests/tours/website_form_editor.js 138 additions, 0 deletionsaddons/website/static/tests/tours/website_form_editor.js
- addons/website/tests/test_website_form_editor.py 3 additions, 0 deletionsaddons/website/tests/test_website_form_editor.py
Please register or sign in to comment