我有一个使用JavaScript做表单验证和IM试图用jQuery来替换它现有的应用程序。我的表单最多有20个字段,我现在只想验证一个字段。jQuery的表单验证提交处理程序不工作
这是jQuery的功能,我写来验证一个字段。
$(function() {
//$(".submit").click(function(){
// alert("jq");
$("#serviceRtpLogMainForm").validate({
rules: {
p_incdate_in: "required"
},
messages: {
p_incdate_in: "Please enter the inception date."
},
submitHandler: function(form) {
// do other things for a valid form
form.submit();
}
//});
});
而下面是如何形式,提交和有问题的领域正在验证。
<html:form action="/serviceRtpLogMain" styleId="serviceRtpLogMainForm">
<html:text name = "serviceRptLog" property="p_incdate_in" styleId="incidDate" onfocus="cancelRequest1('DATE')" />
<A href="javascript:cal4.popup();">
<td valign="middle" align="left" width="100%" colspan="4" height=38 class="td3" >
<input type=submit value=Submit class="submit">
<input type=reset value=Reset>
</td>
不是我的目的是要验证只是如果字段已填写并提交只有现场已被填充以正确的格式形式。
我在这里做错了什么?
我在$( “#serviceRtpLogMainForm”),在Firefox开发者工具.validate调试点。它甚至去那里..这让我更加困惑。 – DJR