I have 2 jsp files. display.jsp and content.jsp. content.jsp is included in display.jsp i have a form in content.jsp for which i want to perform validation in display.js
Display.jsp
display.js included here
<%@ include file="content.jsp" %>
Content.jsp
<form id="frm" name="frm">
<table width="435px" height ="235px" id ="remtable" align="left" cellpadding="0" cellspacing="0" border="0" class="remarkstable">
<tr>
<td>
<input name="field1" type="text" id="field1" size="40" maxlength="60">
</td>
</tr>
</table>
</form>
display.js
$("#frm").validate({
focusCleanup : false,
onkeyup : false,
onfocusout : false,
focusInvalid : false,
onsubmit : true,
rules:{
field1:{
required: function() {
if ($('#field1').val() == "") {
alert("true");
return true;
} else {
alert("false");
return false;
}
}
}
},
messages:{
uploadfile:{
required : "Enter Subject"
}
}
});
The validate method is outside document ready as it is only for display.jsp. I call the validate method from onclick of content.jsp using .valid(). Validation dosen't happen. Any help ?