Improve HTMLForm (and Special:ChangeCredentials) cancel button
authorGergő Tisza <gtisza@wikimedia.org>
Thu, 2 Jun 2016 14:17:13 +0000 (14:17 +0000)
committerGergő Tisza <gtisza@wikimedia.org>
Thu, 2 Jun 2016 19:42:44 +0000 (19:42 +0000)
commit0c9712c31a7202be8c983a01a7077e4ab5a6dd1d
treefcfa687f36987bb4ed607a36920b1d2469a6ad63
parentb19ff388467ce9fb09ebb32655dc401130102f64
Improve HTMLForm (and Special:ChangeCredentials) cancel button

Add two new HTMLForm methods:
* showCancel( [bool] ) to display a cancel button
* setCancelTarget( Title|string ) to set where it should take
  the user.

The cancel button is a simple link formatted as a button.
This is faster than a real button (skips an unnecessary
submit and redirect) and avoids some UX problems:
* when clicking on a real button, HTML5 or JS  validators
  might prevent submission, which does not make sense for cancel
* form field values might get saved by the brower, which again
  does not make sense for cancelling

Use the cancel button for Special:ChangeCredentials.

Bug: T136809
Change-Id: Ieb80e2ff36751abc6f00e2a02926fe9800666a8b
includes/htmlform/HTMLForm.php
includes/htmlform/OOUIHTMLForm.php
includes/htmlform/VFormHTMLForm.php
includes/specials/SpecialChangeCredentials.php
languages/i18n/en.json
languages/i18n/qqq.json