Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3874)

Unified Diff: chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js

Issue 2366783002: MD Settings: Search engine dialog, tweak logic to show "input invalid". (Closed)
Patch Set: Undo Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js b/chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js
index 7f36e61e898c67708316f69c42b891636ee340be..bf275f9ac548d4c2b67bf3c21e3443c3407f8cfc 100644
--- a/chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js
+++ b/chrome/browser/resources/settings/search_engines_page/search_engine_dialog.js
@@ -98,6 +98,14 @@ Polymer({
validate_: function(event) {
var inputElement = Polymer.dom(event).localTarget;
+ // If element is empty, disable the action button, but don't show the red
+ // invalid message.
+ if (inputElement.value == '') {
+ inputElement.invalid = false;
+ this.updateActionButtonState_();
+ return;
+ }
+
this.browserProxy_.validateSearchEngineInput(
inputElement.id, inputElement.value).then(function(isValid) {
inputElement.invalid = !isValid;
@@ -110,7 +118,7 @@ Polymer({
var allValid = [
this.$.searchEngine, this.$.keyword, this.$.queryUrl
].every(function(inputElement) {
- return !inputElement.invalid && inputElement.value.length != 0;
+ return !inputElement.invalid && inputElement.value.length > 0;
});
this.$.actionButton.disabled = !allValid;
},

Powered by Google App Engine
This is Rietveld 408576698