[jQuery] Error with custom method
Hi,
I try to make a custom method which indicates if the field "room
Number" is available. And I have this error :
jQuery.validator.methods[method] is undefined
with this code :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="style/cmxformTemplate.css" type="text/css"
rel="stylesheet" />
<script type="text/javascript" src="javascript/
jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="javascript/
jquery.validate.min.js"></script>
</head>
<body>
<form id="conferenceForm" class="cmxform"
action="javascript:alert('OK');" method="post" autocomplete="off">
<fieldset>
<label for="jqmRoomNumber">Room Number</label>
<em>*</em>
<input type="text" MAXLENGTH="6" id="jqmRoomNumber"
name="jqmRoomNumber"/>
<input type="submit" value="Create"/>
<input type="button" value="Cancel" onclick="hidePopup()" />
</fieldset>
</form>
<script type="text/javascript">
$(function() {
$.validator.addMethod("roomNumber", function (value, element, param)
{
return true;
},
"Your room number is not available");
$("#conferenceForm").validate({
rules: {
jqmRoomNumber: {
required: true,
roomNumber:true,
minLength:2
}
},
messages: {
jqmRoomNumber: {
required: "Please enter a room Number",
minLength: "Your login must consist of at least 2 characters"
}
}
});
});
</script>
</body>
</html>
For now, I have made un simple custom method which return always
"true" to understand how .