mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Merge "CollabTarget: Disable submit button when input is invalid"
This commit is contained in:
commit
0034fb3c65
|
@ -70,6 +70,14 @@
|
|||
documentNameField.toggle( true );
|
||||
}
|
||||
|
||||
function onChange() {
|
||||
documentNameInput.getValidity().then( function () {
|
||||
submitButton.setDisabled( false );
|
||||
}, function () {
|
||||
submitButton.setDisabled( true );
|
||||
} );
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
documentNameInput.getValidity().then( function () {
|
||||
var title = mw.Title.newFromText( documentNameInput.getValue() ),
|
||||
|
@ -95,8 +103,10 @@
|
|||
} );
|
||||
submitButton.setDisabled( false );
|
||||
|
||||
documentNameInput.on( 'change', onChange );
|
||||
documentNameInput.on( 'enter', onSubmit );
|
||||
submitButton.on( 'click', onSubmit );
|
||||
onChange();
|
||||
|
||||
if ( pageTitle ) {
|
||||
showPage( pageTitle );
|
||||
|
|
Loading…
Reference in a new issue