Using this Code:
<
div
id
=
"myform"
>
<
ul
>
<
li
>name <
input
name
=
"ctl00$MainContent$tbName"
id
=
"MainContent_tbName"
style
=
"width: 100px;"
type
=
"text"
required
validationmessage
=
"fill in name"
/></
li
>
<
li
>firstName <
input
type
=
"text"
name
=
"firstName"
required
validationMessage
=
"fill in firstName"
/></
li
>
<
li
>lastName <
input
type
=
"text"
name
=
"lastName"
required
validationMessage
=
"fill in lastName"
/></
li
>
</
ul
>
<
button
id
=
"save"
type
=
"button"
>
Save</
button
>
</
div
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
var validator = $("#myform").kendoValidator().data("kendoValidator");
$("#save").click(function () {
if (validator.validate()) {
alert('juhu');
}
});
});
</
script
>
Validation works almost fine. All three messages are shown when hitting the save button. Hitting the save button for the second time the first message disappears.
I changed the code as follow (switching input text 1 and 2):
<
ul
>
<
li
>firstName <
input
type
=
"text"
name
=
"firstName"
required
validationMessage
=
"fill in firstName"
/></
li
>
<
li
>name <
input
name
=
"ctl00$MainContent$tbName"
id
=
"MainContent_tbName"
style
=
"width: 100px;"
type
=
"text"
required
validationmessage
=
"fill in name"
/></
li
>
<
li
>lastName <
input
type
=
"text"
name
=
"lastName"
required
validationMessage
=
"fill in lastName"
/></
li
>
</
ul
>
Now only the first and third message is shown. When I hit the save button for the second time the first message disappears also.
The page is build from an ASP.NET 4.0 Webforms project using MasterPages. The "name input" is generated aspx => html code pasted manually in this page.