Merge "CollabTarget: Disable submit button when input is invalid"

This commit is contained in:
jenkins-bot 2017-09-15 00:22:12 +00:00 committed by Gerrit Code Review
commit 0034fb3c65

View file

@ -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 );