jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/324950 )
Change subject: HTMLFormFieldCloner: Set 'formnovalidate' on add/remove field buttons ...................................................................... HTMLFormFieldCloner: Set 'formnovalidate' on add/remove field buttons Otherwise, after we allow HTML5 form validation attributes, these buttons wouldn't work for non-JS users (unless the whole form was otherwise valid). Change-Id: Ia9c16849774c186b991280ea60fc5608ddd4cf42 --- M includes/htmlform/fields/HTMLButtonField.php M includes/htmlform/fields/HTMLFormFieldCloner.php 2 files changed, 13 insertions(+), 0 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified Anomie: Looks good to me, approved diff --git a/includes/htmlform/fields/HTMLButtonField.php b/includes/htmlform/fields/HTMLButtonField.php index 500b502..a19bd5a 100644 --- a/includes/htmlform/fields/HTMLButtonField.php +++ b/includes/htmlform/fields/HTMLButtonField.php @@ -13,6 +13,9 @@ * of the value from 'default'. Overrides 'buttonlabel-raw'. * - buttonlabel-raw: HTMLto display for the button display text, instead * of the value from 'default'. + * - formnovalidate: Set to true if clicking this button should suppress + * client-side form validation. Used in HTMLFormFieldCloner for add/remove + * buttons. * * Note that the buttonlabel parameters are not supported on IE6 and IE7 due to * bugs in those browsers. If detected, they will be served buttons using the @@ -27,10 +30,16 @@ /** @var array $mFlags Flags to add to OOUI Button widget */ protected $mFlags = []; + protected $mFormnovalidate = false; + public function __construct( $info ) { $info['nodata'] = true; if ( isset( $info['flags'] ) ) { $this->mFlags = $info['flags']; + } + + if ( isset( $info['formnovalidate'] ) ) { + $this->mFormnovalidate = $info['formnovalidate']; } # Generate the label from a message, if possible @@ -71,6 +80,7 @@ 'type' => $this->buttonType, 'name' => $this->mName, 'value' => $this->getDefault(), + 'formnovalidate' => $this->mFormnovalidate, ] + $this->getAttributes( [ 'disabled', 'tabindex' ] ); if ( $this->isBadIE() ) { diff --git a/includes/htmlform/fields/HTMLFormFieldCloner.php b/includes/htmlform/fields/HTMLFormFieldCloner.php index abb50d0..8fb840a 100644 --- a/includes/htmlform/fields/HTMLFormFieldCloner.php +++ b/includes/htmlform/fields/HTMLFormFieldCloner.php @@ -57,6 +57,7 @@ if ( isset( $this->mParams['fields']['delete'] ) ) { $class = 'mw-htmlform-cloner-delete-button'; $info = $this->mParams['fields']['delete'] + [ + 'formnovalidate' => true, 'cssclass' => $class ]; unset( $info['name'], $info['class'] ); @@ -310,6 +311,7 @@ : 'htmlform-cloner-delete'; $field = HTMLForm::loadInputFromParameters( $name, [ 'type' => 'submit', + 'formnovalidate' => true, 'name' => $name, 'id' => Sanitizer::escapeId( "{$this->mID}--$key--delete" ), 'cssclass' => 'mw-htmlform-cloner-delete-button', @@ -382,6 +384,7 @@ : 'htmlform-cloner-create'; $field = HTMLForm::loadInputFromParameters( $name, [ 'type' => 'submit', + 'formnovalidate' => true, 'name' => $name, 'id' => Sanitizer::escapeId( "{$this->mID}--create" ), 'cssclass' => 'mw-htmlform-cloner-create-button', -- To view, visit https://gerrit.wikimedia.org/r/324950 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia9c16849774c186b991280ea60fc5608ddd4cf42 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits