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

Unified Diff: Source/core/html/forms/DateInputType.cpp

Issue 461323006: input[type=date] warns if specified string is invalid. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « Source/core/html/forms/DateInputType.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/DateInputType.cpp
diff --git a/Source/core/html/forms/DateInputType.cpp b/Source/core/html/forms/DateInputType.cpp
index 98146284ba2fff0243604b476e33a93fe3254a57..5bfe2c320b012405e31b22d28ac0c539ecb67f55 100644
--- a/Source/core/html/forms/DateInputType.cpp
+++ b/Source/core/html/forms/DateInputType.cpp
@@ -33,6 +33,7 @@
#include "core/HTMLNames.h"
#include "core/InputTypeNames.h"
+#include "core/dom/Document.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/forms/DateTimeFieldsState.h"
#include "platform/DateComponents.h"
@@ -93,6 +94,14 @@ bool DateInputType::isDateField() const
return true;
}
+void DateInputType::warnIfValueIsInvalid(const String& value) const
+{
+ if (value != element().sanitizeValue(value)) {
+ element().document().addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel,
+ String::format("The specified value '%s' does not conform to the required format, 'yyyy-MM-dd'.", value.utf8().data())));
+ }
+}
+
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
String DateInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
{
« no previous file with comments | « Source/core/html/forms/DateInputType.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698