Skip to content

Instantly share code, notes, and snippets.



Last active Jul 20, 2016
What would you like to do?
Validator: basic usage
<require from="./basic-use.css"></require>
<div id="example">
<div class="demo-section k-content">
<div id="tickets">
<form id="ticketsForm" submit.delegate="submit($event)" ak-validator="k-widget.two-way: validator">
<ul id="fieldlist">
<label for="fullname" class="required">Your Name</label>
<input type="text" id="fullname" name="fullname" class="k-textbox" placeholder="Full name" required validationMessage="Enter {0}" style="width: 220px;" />
<label for="search" class="required">Movie</label>
<ak-autocomplete k-data-source.bind="data" k-separator=", ">
<input type="search" id="search" name="search" required validationMessage="Select movie" style="width: 220px;" /><span class="k-invalid-msg" data-for="search"></span>
<label for="time">Start time</label>
<select name="time" id="time" required data-required-msg="Select start time" style="width: 220px;" >
<span class="k-invalid-msg" data-for="time"></span>
<label for="amount">Amount</label>
<input id="amount" name="Amount" type="text" ak-numerictextbox="k-min.bind: 1; k-max.bind: 10; k-value.bind: 1" required data-max-msg="Enter value between 1 and 10" style="width: 220px;" />
<span class="k-invalid-msg" data-for="Amount"></span>
<label for="email" class="required">Email</label>
<input type="email" id="email" name="Email" class="k-textbox" placeholder="e.g." required data-email-msg="Email format is not valid" style="width: 220px;"/>
<label for="tel" class="required">Phone</label>
<input type="tel" id="tel" name="tel" class="k-textbox" pattern="\d{10}" placeholder="Enter a ten digit number" required
validationMessage="Enter at least ten digits" style="width: 220px;" />
<li class="accept">
<label>Terms of Service</label>
<input type="checkbox" name="Accept" required validationMessage="Acceptance is required" /> <p>I accept the terms of service.</p>
<li class="confirm">
<button class="k-button k-primary" type="submit">Submit</button>
<li class="status" ref="status">
export class BasicUse {
data = [
'12 Angry Men',
'Il buono, il brutto, il cattivo.',
'One Flew Over the Cuckoo\'s Nest',
'Pulp Fiction',
'Schindler\'s List',
'The Dark Knight',
'The Godfather',
'The Godfather: Part II',
'The Shawshank Redemption'
submit(event) {
if (this.validator.validate()) {
$(this.status).text('Hooray! Your tickets has been booked!')
} else {
$(this.status).text('Oops! There is invalid data in the form.')
#fieldlist {
margin: 0;
padding: 0;
#fieldlist li {
list-style: none;
padding-bottom: .7em;
text-align: left;
#fieldlist label {
display: block;
padding-bottom: .3em;
font-weight: bold;
text-transform: uppercase;
font-size: 12px;
color: #444;
#fieldlist li.status {
text-align: center;
#fieldlist li .k-widget:not(.k-tooltip),
#fieldlist li .k-textbox {
margin: 0 5px 5px 0;
.confirm {
padding-top: 1em;
.valid {
color: green;
.invalid {
color: red;
#fieldlist li input[type="checkbox"] {
margin: 0 5px 0 0;
span.k-widget.k-tooltip-validation {
display; inline-block;
width: 160px;
text-align: left;
border: 0;
padding: 0;
margin: 0;
background: none;
box-shadow: none;
color: red;
.k-tooltip-validation .k-warning {
display: none;
<!doctype html>
<title>Aurelia KendoUI bridge</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<script src=""></script>
<body aurelia-app="main">
<script src=""></script>
<script src=""></script>
export function configure(aurelia) {
.plugin('aurelia-kendoui-bridge', kendo =>;
aurelia.start().then(a => a.setRoot());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment