Hello,
I cannot get patern to work, can get requiredto work but not patern.
I cannot get patern to work, can get requiredto work but not patern.
<
li
>
<
label
for
=
"cities"
>
Zip code:</
label
>
<
input
id
=
"contact_cities"
data-bind
=
"value: contact_zip"
name
=
"contact_cities"
pattern
=
"\d{5}"
placeholder
=
"Invalid zip code"
validationmessage
=
"Invalid zip code."
/><
span
class
=
"k-invalid-msg"
data-for
=
"cities"
></
span
></
li
>
<
li
>
.....
$(document).ready(function () {
var viewModel = kendo.observable({
firstName: $.cookie("firstName"),
lastName: $.cookie("lastName"),
email: $.cookie("email"),
phone: $.cookie("phone"),
contact_zip: $.cookie("zip"),
valid: false,
contactseller: function () {
if (validator.validate()) {
$.cookie("firstName", $("#firstname").val(), { expires: 7, path: '/' });
$.cookie("lastName", $("#lastname").val(), { expires: 7 , path: '/'});
$.cookie("email", $("#email").val(), { expires: 7 , path: '/'});
$.cookie("phone", $("#phone").val(), { expires: 7 , path: '/'});
$.cookie("zip", $("#contact_cities").val(), { expires: 7 , path: '/'});
status.text("Hooray! Your tickets has been booked!").addClass("valid");
} else {
status.text("Oops! There is invalid data in the form.").addClass("invalid");
}
}
});
kendo.bind($("#contactSeller"), viewModel);
var validator = $("#contactSeller").kendoValidator().data("kendoValidator"), status = $(".status");
$("#contact_cities").kendoComboBox({
placeholder: "Select zip code",
dataTextField: "Label",
dataValueField: "Value",
filter: "contains",
dataSource: {
serverFiltering: true,
transport: {
read: {
url: '@Url.Action("GetCities", "MainSearch")',
data: function () {
var combobox = $("#contact_cities").data("kendoComboBox");
return {
zip: combobox.input.val()
};
}
}
}
}
});
$("img[title]").tooltip();
$('.submit-link').click(function () {
var input = $(this).attr('id');
$("#lastId").val(input);
var window = $("#contactSeller").data("kendoWindow"); window.center(); window.open();
});
var window = $("#contactSeller").kendoWindow({
title: "Contact Seller",
visible: false,
modal: true,
resizable: false
}).data("kendoWindow");
});