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

Unified Diff: chrome/browser/resources/print_preview/data/ticket_items/copies.js

Issue 2713033003: Print Preview: Show error message if text is typed in Copies section (Closed)
Patch Set: Use valueAsNumber instead of Number ToFixed Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/ticket_items/scaling.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/data/ticket_items/copies.js
diff --git a/chrome/browser/resources/print_preview/data/ticket_items/copies.js b/chrome/browser/resources/print_preview/data/ticket_items/copies.js
index 91e6acf475ddeafc719e53535df5c29632628fcb..22098be470a72c5b770ceba194f34cb50499c2ef 100644
--- a/chrome/browser/resources/print_preview/data/ticket_items/copies.js
+++ b/chrome/browser/resources/print_preview/data/ticket_items/copies.js
@@ -24,14 +24,7 @@ cr.define('print_preview.ticket_items', function() {
/** @override */
wouldValueBeValid: function(value) {
- if (/[^\d]+/.test(value)) {
- return false;
- }
- var copies = parseInt(value, 10);
- if (copies > 999 || copies < 1) {
- return false;
- }
- return true;
+ return value != '';
},
/** @override */
@@ -41,7 +34,8 @@ cr.define('print_preview.ticket_items', function() {
/** @return {number} The number of copies indicated by the ticket item. */
getValueAsNumber: function() {
- return parseInt(this.getValue(), 10);
+ var value = this.getValue();
+ return value == '' ? 0 : parseInt(value, 10);
},
/** @override */
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/ticket_items/scaling.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698