<body>
<form id="custom">
<table>
<tr>
<td class="e-leftfields e-textlabel" style="width: 20%;">Job Type:
</td>
<td style="width: 1%;">
<input type="text" id="ddlAddJobType" />
<span class="errmsg"></span>
</td>
<td>
<button type="submit" onclick="save()" id="btnsubmit" style="float: left; margin-left: 38%; margin-bottom: 10px;">
Save</button></td>
</table>
</form>
<script type="text/javascript">
$.validator.setDefaults({
ignore: [], // to include hidden input validation
errorClass: 'e-validation-error', // to get the error message on jquery validation
errorPlacement: function (error, element) {
$(element).closest("form").append(error);
} // to place error message
});
var JobTypes = [{ JobTypeDescription: "job", JobTypeID: "1" }]
$('#ddlAddJobType').ejDropDownList({
dataSource: JobTypes,
fields: {
text: "JobTypeDescription",
value: "JobTypeID"
},
validationRules: {
required: true
},
validationMessage: {
required: "Select JobType value"
},
watermarkText: "Select Job Type"
// htmlAttributes: {
// style: "border:1px solid red;"
// }
});
function save() {
$("#custom").valid();
}
</script>
</body>
</html> |