mw.htmlform: Fields hidden with 'hide-if' should be disabled
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 19 Sep 2016 17:03:19 +0000 (19:03 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Fri, 2 Dec 2016 18:22:38 +0000 (19:22 +0100)
commit5d5dbc83da4bc339e6c2f7fb3d346ba259192b68
tree31ef41b8291a88e2130e3b6cbed762017f0a18e7
parentae99e6724355dac31083206c96a7b2a2ef0d755b
mw.htmlform: Fields hidden with 'hide-if' should be disabled

Otherwise, in browsers that support HTML5 form validation, it
would be impossible to submit the form if a field failing
validation was hidden (e.g. because it's marked as required).

Note that disabled fields are not submitted with the form. This
should be okay, as server-side validation ignores them entirely.
(I37e50799ba1f0e0e64a197818b58444f5b056bf0 fixes a corner case.)

For cloner fields, 'hide-if' rules of the parent are now copied
to the children, to make handling such nested fields simpler.

Bug: T145440
Change-Id: I81d04dca6cbb499a15828fd33b01746b68c694da
includes/htmlform/fields/HTMLFormFieldCloner.php
resources/src/mediawiki/htmlform/hide-if.js