Bug Tracker

Modify

Ticket #7507 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

Custom validation does not work test method undefined

Reported by: kris.nobels@… Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

Hello,

I created a custom validation like this

<script type="text/javascript">
141 $(
142 function () {
143 $('#uiGSMnrs').focus();
144
145 jQuery.validator.addMethod(
146'regex',
147function(value, element, regexp) {
148return this.optional(element) || regexp.test(value);
149},
150'Waarde niet geldig'
151);
152
153$('#SMSForm').validate({
154 rules: {
155 uiGSMnrs:{
156 required: true,
157 minlength: 10,
158 regex: '^([+]?[0-9]{10,14}[;]?)+$'
159 },
160 uiBericht:{
161 required: true,
162 maxlength: 160
163 }
164 },
165 messages: {
166 uiGSMnrs:{
167 required: 'Verplicht veld',
168 minlength: 'Minimum 10 charaters vereist',
169 regex: 'Waarde niet geldig'
170 },
171 uiBericht:{
172 required: 'Verplicht veld',
173 maxlength: 'Maximum 160 charaters vereist'
174 }
175 }
176});
177 }
178);
179 </script> 

But the result is that the validation is not working at all. :-(

You can see a screenshot from firebug here

 http://lh3.ggpht.com/_G2Zw9Fyi6WM/TN-9OguZonI/AAAAAAAABOc/2-ggUz1heRs/s1600/Jqueryvalidation.png

I use jQuery validation plug-in 1.7 with jQuery JavaScript Library v1.4.2

Please contact me kris.nobels[at]gmail.com

Change History

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

This is not a jQuery core bug. Please ask for help on the forum.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.