hi,
I am trying to follow the very simple validation example. I have this written:
$(document).ready(function () {
var validatable = $("#myform").kendoValidator().data("kendoValidator");
$("#save").click(function () {
if (validatable.validate()) {
alert('Valid');
} else {
alert('Not valid');
}
});
});
and html:
<div id="myForm">
<fieldset>
<label for="Name">Name</label>
<input type="text" id="Name" name="Name" required/>
<br/>
<label for="Age">Age</label>
<input type="text" id="Age" name="Age">
<br/>
<label for="Phone">Phone</label>
<input type="text" title="Phone Number" id="Phone" pattern="\d{10}" validationMessage="please enter a ten digit phone number"/>
<br/>
<button id="save" type="button" class="k-button"></button>
<!--<input type="submit" id="Submit" value="Submit" @*onclick="checkValidation()"*@/>-->
</fieldset>
it says that 'validatable' is not defined. But what's weird is when I step through the code in Firebug, it shows the proper return when I call manually $("#myform").kendoValidator().data("kendoValidator"). It seems only if I put it in a variable, that variable is undefined.
Can anyone help? maybe I am missing some JS references? Which ones do I need for this? please help.
thanks!
I am trying to follow the very simple validation example. I have this written:
$(document).ready(function () {
var validatable = $("#myform").kendoValidator().data("kendoValidator");
$("#save").click(function () {
if (validatable.validate()) {
alert('Valid');
} else {
alert('Not valid');
}
});
});
and html:
<div id="myForm">
<fieldset>
<label for="Name">Name</label>
<input type="text" id="Name" name="Name" required/>
<br/>
<label for="Age">Age</label>
<input type="text" id="Age" name="Age">
<br/>
<label for="Phone">Phone</label>
<input type="text" title="Phone Number" id="Phone" pattern="\d{10}" validationMessage="please enter a ten digit phone number"/>
<br/>
<button id="save" type="button" class="k-button"></button>
<!--<input type="submit" id="Submit" value="Submit" @*onclick="checkValidation()"*@/>-->
</fieldset>
it says that 'validatable' is not defined. But what's weird is when I step through the code in Firebug, it shows the proper return when I call manually $("#myform").kendoValidator().data("kendoValidator"). It seems only if I put it in a variable, that variable is undefined.
Can anyone help? maybe I am missing some JS references? Which ones do I need for this? please help.
thanks!