HTMLForm: Suppress HTML5 form validation for non-JS users when needed
authorBartosz Dziewoński <matma.rex@gmail.com>
Fri, 2 Dec 2016 18:17:35 +0000 (19:17 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 10 Jan 2017 22:49:38 +0000 (22:49 +0000)
commit38cc8a697f59b6e73b967177bf7b376f010bd4ab
tree39bcfc9fcbd0956cdbae563f09696437e61485af
parent2116f0926b354b42235d6c7092d65db6b3583ce0
HTMLForm: Suppress HTML5 form validation for non-JS users when needed

Our 'hide-if' fields are fundamentally incompatible with HTML5 form
validation attributes. If you have a checkbox field A, and field B
that is required, but hidden if A is unchecked - that's impossible to
express with HTML5 form validation. The only thing you can do is
remove the validation on B (or on the entire form).

The field contents are still validated server-side, just like if the
browser did not support HTML5 forms. The validation is also re-enabled
in JavaScript, since we have extra support for 'hide-if' field that
makes them work.

Change-Id: Ia7ffa76965a7c14af9b6d2db007b6255498398d9
includes/htmlform/HTMLForm.php
includes/htmlform/HTMLFormField.php
resources/src/mediawiki/htmlform/htmlform.js