Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
improve validation demo for input
Browse files Browse the repository at this point in the history
  • Loading branch information
samccone committed Jul 16, 2014
1 parent 7b3619f commit 389bac5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
margin: 1em;
}

#singleValidation.invalid {
border: solid 1px red;
}

#singleValidation {
border: solid 1px lime;
}

core-input[multiline] {
border: 1px dotted #ccc;
}
Expand Down Expand Up @@ -69,14 +77,17 @@
});
</script>
</section>

<section horizontal start layout>
<aside>This is an example of a single-line text input with number validation. See console for validation errors.</aside>
<aside>This is an example of a single-line text input with number validation. The border color reflects the current validation state. See console for validation errors or validity.</aside>
<core-input id="singleValidation" placeholder="Only enter numbers..." validate="^[0-9]*$"></core-input>
<script>
document.getElementById('singleValidation').addEventListener('input-invalid', function(e, value, s) {
console.log('singleValidation: input invalid! value:', e.detail.value);
});
document.getElementById('singleValidation').addEventListener('input-valid', function(e, value, s) {
console.log('singleValidation: input valid! value:', e.detail.value);
});
</script>
</section>

Expand Down

0 comments on commit 389bac5

Please sign in to comment.