I am trying to use the validator with the upload control and even though I have selected a file, the validation is returning false. Attached is the source and the image.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Upload documents for Andy Redi</title>
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="/Content/Kendu/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="/Content/Kendu/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="/Content/Kendu/js/kendo.all.min.js" type="text/javascript"></script>
</head>
<body>
<div class="page">
<header>
<div class="clear">
</div>
<div class="log-on">
Welcome <a href="/Account/Details">thilehoffer</a>
<a href="/Account/LogOff">Log Off</a>
<a href="/Admin">Admin</a>
</div>
<div class="clear">
</div>
</header>
<section id="main">
<h2>Upload documents for Andy Redi</h2>
<form
action="/Document/Create/3aaa624e-7f23-4532-9c24-10315cd665af"
enctype="multipart/form-data" method="post"><input id="StudentId"
name="StudentId" type="hidden"
value="3aaa624e-7f23-4532-9c24-10315cd665af" /> <fieldset>
<legend>Upload Files</legend>
<div class="data-entry-container">
<label for="CategoryList">
Document Category</label></div>
<div class="data-entry-container">
<select id="CategoryList" name="CategoryList" required validationmessage="Category is required">
<option value=''> </option>
<option value='1'>IEP </option>
<option value='2'>Evaluation </option>
<option value='3'>Other </option>
</select>
</div>
<div class="data-entry-container">
<span class="k-invalid-msg" data-for="CategoryList"></span>
</div>
<div class="clear">
</div>
<div class="data-entry-container">
<label for="PostedFileBase">
Document File</label></div>
<div class="data-entry-container">
<input id="PostedFileBase" name="PostedFileBase"
type="file" validationmessage="A file is required" required/>
</div>
<div class="data-entry-container">
<span class="k-invalid-msg" data-for="PostedFileBase"></span>
</div>
<div class="clear">
</div>
<br />
<input id="CategoryId" name="CategoryId" type="hidden" value="0" />
<input type="submit" value="Save File" />
</fieldset>
<p>
<a Length="0"
href="/Student/Documents/3aaa624e-7f23-4532-9c24-10315cd665af">Back
to documents for Andy Redi</a>
</p>
<script type="text/javascript">
//Functions
/*Set the value of hidden fields that will store the value selected from the drop down*/
function CategoryListChange() {
var dropdownlist = $("#CategoryList").data("kendoDropDownList");
var hiddenField = $("#CategoryId");
hiddenField.val(dropdownlist.value());
}
$(document).ready(function () {
$("#CategoryList").kendoDropDownList({ change: CategoryListChange });
$("#PostedFileBase").kendoUpload({multiple: false });
var validatable = $("form").kendoValidator().data("kendoValidator");
$("#save").click(function () {
if (validatable.validate()) {
return true;
}
return false;
});
});
</script>
</form>
</section>
<footer>
</footer>
</div>
</body>
</html>