Error with custom method
|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Error with custom methodHi, 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> <p> <label for="jqmRoomNumber">Room Number</label> <em>*</em> <input type="text" MAXLENGTH="6" id="jqmRoomNumber" name="jqmRoomNumber"/> </p> <p> <input type="submit" value="Create"/> <input type="button" value="Cancel" onclick="hidePopup()" /> </p> </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 . |
|
|
Re: Error with custom methodjqmRoomNumber and roomNumber doen't match. Jörn On Tue, Jul 22, 2008 at 3:59 PM, CocoLeNain <nicolas.jan29@...> wrote: > > 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> > <p> > <label for="jqmRoomNumber">Room Number</label> > <em>*</em> > <input type="text" MAXLENGTH="6" id="jqmRoomNumber" > name="jqmRoomNumber"/> > </p> > > <p> > <input type="submit" value="Create"/> > <input type="button" value="Cancel" onclick="hidePopup()" /> > </p> > </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 . > |
|
|
Re: Error with custom methodjqmRoomNumber is just a id of an input and roomNumber is the name of my custom method (if I don't make mistake). I don't understand why jqmRoomNumber and roomNumber doen't match. On 22 juil, 20:42, "Jörn Zaefferer" <joern.zaeffe...@...> wrote: > jqmRoomNumber and roomNumber doen't match. > > Jörn > > On Tue, Jul 22, 2008 at 3:59 PM, CocoLeNain <nicolas.ja...@...> wrote: > > > 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> > > <p> > > <label for="jqmRoomNumber">Room Number</label> > > <em>*</em> > > <input type="text" MAXLENGTH="6" id="jqmRoomNumber" > > name="jqmRoomNumber"/> > > </p> > > > <p> > > <input type="submit" value="Create"/> > > <input type="button" value="Cancel" onclick="hidePopup()" /> > > </p> > > </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 . |
|
|
Re: Error with custom methodSorry, my mistake. The issue isn't the roomNumber method, but the minLength-method. Give "minlength" a try. See http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods Jörn On Wed, Jul 23, 2008 at 9:22 AM, CocoLeNain <nicolas.jan29@...> wrote: > > jqmRoomNumber is just a id of an input and roomNumber is the name of > my custom method (if I don't make mistake). I don't understand why > jqmRoomNumber and roomNumber doen't match. > > On 22 juil, 20:42, "Jörn Zaefferer" <joern.zaeffe...@...> > wrote: >> jqmRoomNumber and roomNumber doen't match. >> >> Jörn >> >> On Tue, Jul 22, 2008 at 3:59 PM, CocoLeNain <nicolas.ja...@...> wrote: >> >> > 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> >> > <p> >> > <label for="jqmRoomNumber">Room Number</label> >> > <em>*</em> >> > <input type="text" MAXLENGTH="6" id="jqmRoomNumber" >> > name="jqmRoomNumber"/> >> > </p> >> >> > <p> >> > <input type="submit" value="Create"/> >> > <input type="button" value="Cancel" onclick="hidePopup()" /> >> > </p> >> > </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 . > |
|
|
Re: Error with custom methodThanks for your help, I didn't read attentively the doc and I didn't see the method "remote(url)". This is my code for those which that interest : $("#conferenceForm").validate({ rules: { jqmRoomNumber: { required: true, remote:"toto.php", digit:true }, ... } }); file toto.php <?php if($_GET['jqmRoomNumber'] != "Toto"){ echo "true"; }else{ echo "false"; } ?> On 23 juil, 22:03, "Jörn Zaefferer" <joern.zaeffe...@...> wrote: > Sorry, my mistake. The issue isn't the roomNumber method, but the > minLength-method. Give "minlength" a try. Seehttp://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation... > > Jörn > > On Wed, Jul 23, 2008 at 9:22 AM, CocoLeNain <nicolas.ja...@...> wrote: > > > jqmRoomNumber is just a id of an input and roomNumber is the name of > > my custom method (if I don't make mistake). I don't understand why > > jqmRoomNumber and roomNumber doen't match. > > > On 22 juil, 20:42, "Jörn Zaefferer" <joern.zaeffe...@...> > > wrote: > >> jqmRoomNumber and roomNumber doen't match. > > >> Jörn > > >> On Tue, Jul 22, 2008 at 3:59 PM, CocoLeNain <nicolas.ja...@...> wrote: > > >> > 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> > >> > <p> > >> > <label for="jqmRoomNumber">Room Number</label> > >> > <em>*</em> > >> > <input type="text" MAXLENGTH="6" id="jqmRoomNumber" > >> > name="jqmRoomNumber"/> > >> > </p> > > >> > <p> > >> > <input type="submit" value="Create"/> > >> > <input type="button" value="Cancel" onclick="hidePopup()" /> > >> > </p> > >> > </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 . |
| Free Forum Powered by Nabble | Forum Help |