我正在使用jquery验证,它没有捕获不符合验证条件的实例?这对我来说很奇怪,部分是因为它之前正在工作(我现在在兼容模式下使用IE 8,会影响某些东西吗?)...
我脑子里似乎没有任何编译异常?我导入jquery验证src文件的位置会影响它的工作方式???这是我的代码......
$("#temp1").validate({
rules: {
HospitalFinNumber: {
required: true,
minlength: 6
},
DateOfBirth: {
required: true
},
AdmitDate: {
required: true
},
Comment: {
required: function (element) {
return $(element).val().length < 4000;
},
maxlength: 4000
}
},
messages: {
HospitalFinNumber: 'Please Enter a Hospital Fin number',
DateOfBirth: 'Please enter a valid Date Of Birth',
AdmitDate: 'Please select an Admit Date',
Comment: 'Why dont you stop attempting to put in more than 4000 characters? Thanks...'
}
});
以下是我的资料来源......
<script src="<%=Url.Content("~/Scripts/js/jquery-ui-1.8.15.custom.min.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.validate.min.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.timeentry.min.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.maskedinput-1.3.min.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/charCount.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.filter_input.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/simpleTimeMask.js")%>" type="text/javascript"></script>
表单元素:
<div class="edit-set" id="EditTemplate">
<form action="/PatientACO/UpdateXML?template=592&PopPatId=1139&EncOrAdd=0" id="temp1" method="post" name="editTemp"><div class="validation-summary-valid" id="validationSummary"><ul><li style="display:none"></li>
</ul></div>
Activate/Deactivate Patient
<div id="deactivateNO" style="display:none"><input id="deactivate" name="deactivate" type="radio" value="N" />Deactivate</div>
<div id="deactivateYES" style="display:none"><input id="deactivate" name="deactivate" type="radio" value="A" />Activate</div>
<table width="500" class="odd"><tr><td><label for="BLUE">First Name</label></td><td> <input id="element6" name="FirstName" readonly="True" type="text" value="BLUE" /></td></tr> <tr><td><label for="CRAYON">Last Name</label></td><td><input id="element7" name="LastName" readonly="True" type="text" value="CRAYON" /></td></tr><tr><td><label for="10/31/1966 12:00:00 AM">Date Of Birth</label></td><td><input class="datepicker0" id="date0" name="DateOfBirth" type="text" value="10/31/1966" /><!--supposed to be date input --></td></tr><tr><td><label for="4111111111">Phone</label></td><td><input id="Phone" name="Phone" type="text" value="4111111111" /><!--string input -->
</td></tr><tr><td><label for="111 222 333 444">Hospital Fin Number (**required**)</label></td><td><input id="HospitalFinNumber" name="HospitalFinNumber" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="29-DEC-11">Admit Date (**required**)</label></td><td><input class="datepicker1" id="AdmitDate" name="AdmitDate" type="text" value="" /><!--supposed to be date input --> </td></tr><tr><td><label for="MPACMRN">MRN Type</label></td><td><select id="MPACMRN" name="MRNType"><option selected="selected" value="MPACMRN">Medipac</option>
<option value="NWMRN">NorthWest</option>
<option value="EPIC">Epic</option>
<option value="BEDFORD">Bedford</option>
<option value="CHILDRENS">Childrens</option>
<option value="MAGEE">Magee</option>
<option value="PASSAVANT">Passavant</option>
<option value="MERCY">Mercy</option>
<option value="BEST">Medicare</option>
<option value="HEALTHPLAN">UPMC Health Plan</option>
<option value="EMPIID">EMPI</option>
</select></td></tr><tr><td><label for="840015579">MRN</label></td><td><input id="MRN" name="MRN" type="text" value="840015579" /></td></tr><tr><td><label for="">Patient Room Phone</label></td><td><input id="PatientRoomPhone" name="PatientRoomPhone" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">Discharge Date Time</label></td><td><input class="datepicker2" id="DischargeDateTime" name="DischargeDateTime" type="text" value="" /><!--supposed to be date input --> <input id="DischargeDateTimeMask" name="DischargeDateTimeMask" type="text" value="" /><!--supposed to be date input --></td></tr><tr><td><label for="">Discharge Disposition</label></td><td><input id="DischargeDisposition" name="DischargeDisposition" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">Discharge To</label></td><td><input id="DischargeTo" name="DischargeTo" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="1">Discharge Advocate Call</label> </td><td><input checked="checked" id="element18" name="DischargeAdvocateCall" type="radio" value="1" />Yes<input id="element18" name="DischargeAdvocateCall" type="radio" value="0" />No</td></tr><tr><td><label for="">Payor</label></td><td><input id="Payor" name="Payor" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="1">Home Healthcare Accepted</label> </td><td><input checked="checked" id="element20" name="HomeHealthCareAccepted" type="radio" value="1" />Yes<input id="element20" name="HomeHealthCareAccepted" type="radio" value="0" />No</td></tr><tr><td><label for="1">Safe Landing Accepted</label></td><td><input checked="checked" id="element21" name="SafeLandingAccepted" type="radio" value="1" />Yes<input id="element21" name="SafeLandingAccepted" type="radio" value="0" />No</td></tr> <tr><td><label for="">PCP Name</label></td><td><input id="PCPName" name="PCPName" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">PCP Phone</label></td><td><input id="PCPPhone" name="PCPPhone" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">Specialist Name</label></td><td> <input id="SpecialistName" name="SpecialistName" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">Specialist Phone</label></td><td> <input id="SpecialistPhone" name="SpecialistPhone" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">PCP Appointment Date Time</label> </td><td><input class="datepicker3" id="PCPAppointmentDateTime" name="PCPAppointmentDateTime" type="text" value="" /><!--supposed to be date input --> <input id="PCPAppointmentDateTimeMask" name="PCPAppointmentDateTimeMask" type="text" value="" /><!--supposed to be date input --></td></tr><tr><td><label for="">PCP Appointment Location</label></td><td><input id="PCPAppointmentLocation" name="PCPAppointmentLocation" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">Specialist Appointment Date Time</label></td><td><input class="datepicker4" id="SpecialistAppointmentDateTime" name="SpecialistAppointmentDateTime" type="text" value="" /><!--supposed to be date input --> <input id="SpecialistAppointmentDateTimeMask" name="SpecialistAppointmentDateTimeMask" type="text" value="" /><!--supposed to be date input --></td></tr><tr><td><label for="">Specialist Appointment Location</label></td><td><input id="SpecialistAppointmentLocation" name="SpecialistAppointmentLocation" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="">Completed Pathway</label></td><td><input id="element30" name="CompletedPathway" type="radio" value="1" />Yes<input id="element30" name="CompletedPathway" type="radio" value="0" />No</td></tr><tr><td><label for="">Completed Pathway Reason</label></td><td><input id="CompletedPathwayReason" name="CompletedPathwayReason" type="text" value="" /><!--string input -->
</td></tr><tr><td><label for="Testing the Add function on my development setup.">Comment</label></td><td><textarea cols="60" id="element32" name="Comment" rows="10">
</textarea></td></tr></table>
<p>
<input type="submit" value="Save" class="button" id="btClick"/>
</p>
</div>
</form>
另外,我只是注意到它在ie 8中不起作用但它在chrome中工作?可能存在一些浏览器兼容性问题吗?