Skip to content

Commit a85fd6d

Browse files
fix for validation messages
1 parent a8fc060 commit a85fd6d

File tree

2 files changed

+57
-20
lines changed

2 files changed

+57
-20
lines changed

demo/index.html

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,43 @@
1414
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
1515
<title>paper-input-date-picker Demo</title>
1616
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
17+
<link rel="import" href="../../paper-button/paper-button.html">
1718
<link rel="import" href="../paper-input-date-picker.html">
1819
</head>
19-
<body unresolved>
20+
<body unresolved>
2021

21-
<p>An example of <code>&lt;paper-input-date-picker&gt;</code>:</p>
22+
<template is="dom-bind" id="app">
2223

23-
<p>An baic example of <code>&lt;paper-input-date-picker&gt;</code>:</p>
24-
<paper-input-date-picker label="Pick a date..."></paper-input-date-picker>
25-
<paper-input-date-picker label="Pick a date (No prefix icon)..." no-prefix-icon="true" style="width: 300px;"></paper-input-date-picker>
26-
27-
28-
<p>An example of <code>&lt;paper-input-date-picker&gt;</code> with validaton messages:</p>
29-
<paper-input-date-picker label="Pick a date..." required auto-validate error-message="needs some date!"></paper-input-date-picker>
30-
31-
<script>
32-
</script>
24+
<p>An example of <code>&lt;paper-input-date-picker&gt;</code>:</p>
25+
26+
<p>An baic example of <code>&lt;paper-input-date-picker&gt;</code>:</p>
27+
<paper-input-date-picker label="Pick a date..."></paper-input-date-picker>
28+
<paper-input-date-picker label="Pick a date (No prefix icon)..." no-prefix-icon="true" style="width: 300px;"></paper-input-date-picker>
29+
30+
31+
<p>An example of <code>&lt;paper-input-date-picker&gt;</code> with validaton messages:</p>
32+
<paper-input-date-picker label="Pick a date..." required auto-validate error-message="needs some date!"></paper-input-date-picker>
33+
34+
<p>An example of <code>&lt;paper-input-date-picker&gt;</code> with validaton messages:</p>
35+
<paper-input-date-picker id="dynInputDate" label="Pick a date..."></paper-input-date-picker>
36+
37+
<paper-button label="Teste" on-tap="onClickDynValidation" auto-validate>Validate</paper-button>
38+
39+
<script>
40+
41+
window.addEventListener('WebComponentsReady', function() {
42+
43+
var app = document.querySelector('#app');
44+
45+
app.onClickDynValidation = function () {
46+
47+
this.$.dynInputDate.errorMessage = 'Errooooooo';
48+
this.$.dynInputDate.setAttribute('invalid', 'true');
49+
50+
console.log('ssdsas', this.$.dynInputDate.value);
51+
};
52+
});
53+
</script>
54+
</template>
3355
</body>
3456
</html>

paper-input-date-picker.html

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,32 @@
7070
<paper-input id="input"
7171
disabled="[[disabled]]"
7272
value="[[dateInputText]]"
73+
invalid="{{invalid}}"
74+
prevent-invalid-input="[[preventInvalidInput]]"
75+
allowed-pattern="[[allowedPattern]]"
76+
validator="[[validator]]"
77+
type="[[type]]"
78+
pattern="[[pattern]]"
79+
required="[[required]]"
80+
autocomplete="[[autocomplete]]"
81+
autofocus="[[autofocus]]"
82+
inputmode="[[inputmode]]"
83+
minlength="[[minlength]]"
84+
maxlength="[[maxlength]]"
85+
min="[[min]]"
86+
max="[[max]]"
87+
step="[[step]]"
88+
name="[[name]]"
7389
placeholder="[[placeholder]]"
7490
always-float-label="[[alwaysFloatLabel]]"
7591
no-label-float="[[noLabelFloat]]"
76-
auto-validate$="[[autoValidate]]"
77-
autocomplete$="[[autocomplete]]"
78-
autofocus$="[[autofocus]]"
79-
inputmode$="[[inputmode]]"
80-
name$="[[name]]"
81-
required$="[[required]]"
82-
maxlength$="[[maxlength]]"
83-
autocapitalize$="[[autocapitalize]]"
92+
auto-validate="[[autoValidate]]"
93+
list="[[lit]]"
94+
size="[[size]]"
95+
autocapitalize="[[autocapitalize]]"
96+
autocorrect="[[autocorrect]]"
97+
autosave="[[autosave]]"
98+
results="[[results]]"
8499
error-message="[[errorMessage]]"
85100
label="[[label]]">
86101
<iron-icon icon="[[prefixIcon]]" hidden="[[noPrefixIcon]]" prefix></iron-icon>

0 commit comments

Comments
 (0)