Empty
HTML
<script src="http://kendo.cdn.telerik.com/2015.3.930/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.default.min.css">
<form>
<div id="appointmentTypeSection" class="dataControl intakeInfoSmall appointmentType"> <span class="inputLabel">Appointment Type:</span>
<label for="rbAppointmentType1">
<input type="radio" id="rbAppointmentType1" name="AppointmentType" value="1" data-bind="checked: appointmentDetails.AppointmentTypeId" />Physician</label>
<label for="rbAppointmentType2">
<input type="radio" id="rbAppointmentType2" name="AppointmentType" value="2" data-bind="checked: appointmentDetails.AppointmentTypeId" />Diagnostic</label>
</div>
<div class="dataControl dataControlSmall" data-bind="invisible: isDiagnosticAppointmentType">
<label for="txtRefPhysicianSpecialty"> Speciality<span style="color:red; font-weight: bold;">*</span></label><br />
<input id="txtRefPhysicianSpecialty" name="txtRefPhysicianSpecialty" class="k-textbox appt" style="border-style:inherit; font-weight:normal" data-role="dropdownlist" data-bind="value: appointmentDetails.PhysPrefSpecialtyId" />
</div>
</form>
JavaScript
intakeView = {
viewModel: kendo.observable({
hasAppointmentData: true,
appointmentDetails: {
AppointmentTypeId: 1,
PhysPrefSpecialtyId: null
},
specialtyDataSource: [{ DisplayValue: "Speciality1", Id: 1 }, { DisplayValue: "Speciality2", Id: 2}]
})
};
$("form").kendoValidator({
rules: {
checkSpecialty: function (input) {
if (intakeView.viewModel.get("hasAppointmentData")) {
if (input.is("[id='rbAppointmentType1']")) {
if (intakeView.viewModel.get("appointmentDetails.AppointmentTypeId") == 1) {
// if ($("#appointmentTypeSection").find("[type=radio]").is(":checked")) {
if (intakeView.viewModel.get("appointmentDetails.PhysPrefSpecialtyId") == null || intakeView.viewModel.get("appointmentDetails.PhysPrefSpecialtyId") === undefined || intakeView.viewModel.get("appointmentDetails.PhysPrefSpecialtyId") === "") {
return false;
}
}
}
}
return true;
}
},
messages: {
checkSpecialty: "Please select a Specialty."
}
});
var specialityDropDown = $("#txtRefPhysicianSpecialty").kendoDropDownList({
dataTextField: "DisplayValue",
dataValueField: "Id",
valuePrimitive: true,
optionLabel: " ",
dataSource: intakeView.viewModel.specialtyDataSource
});
kendo.bind($("form"), intakeView.viewModel);