|
1 | 1 | /*! |
2 | 2 | * Validetta - Client-side form validation jQuery plugin |
3 | | - * Version: 0.7.0 (12 December 2013) |
| 3 | + * Version: 0.8.0 (13 December 2013) |
4 | 4 | * @jQuery Requires: v1.7 or above |
5 | 5 | * @Browser Support : ie8 or above, and all modern browsers |
6 | 6 | * |
|
110 | 110 | // handle click event for checkboxes |
111 | 111 | $( this.form ).find( '[data-validetta][type=checkbox]' ).on( 'click', function( e ){ |
112 | 112 | // fields to be controlled transferred to global variable |
113 | | - fields = that.form.querySelectorAll( '[data-validetta][type=checkbox][name='+ this.name +']' ); |
| 113 | + fields = that.form.querySelectorAll( '[data-validetta][type=checkbox][name="'+ this.name +'"]' ); |
114 | 114 | return that.init.call( that, e ); |
115 | 115 | }); |
116 | 116 | } |
|
193 | 193 | }else if( rules[0] === 'maxChecked' && !that.check.checkbox.maxChecked.call( that, _el, rules[1] ) ){ |
194 | 194 | // Redirect to the first checkbox |
195 | 195 | // I want to see the error message on the first element of checkbox group |
196 | | - _el = that.form.querySelectorAll( 'input[type=checkbox][data-validetta][name='+ _el.name +']' )[0]; |
| 196 | + _el = that.form.querySelectorAll( 'input[type=checkbox][data-validetta][name="'+ _el.name +'"]' )[0]; |
197 | 197 | _errors += messages.maxChecked.replace( '{count}', rules[1] )+'<br />'; |
198 | 198 | }else if( rules[0] === 'minChecked' && !that.check.checkbox.minChecked.call( that, _el, rules[1] ) ){ |
199 | 199 | // Redirect to the first checkbox |
200 | | - _el = that.form.querySelectorAll( 'input[type=checkbox][data-validetta][name='+ _el.name +']' )[0]; |
| 200 | + _el = that.form.querySelectorAll( 'input[type=checkbox][data-validetta][name="'+ _el.name +'"]' )[0]; |
201 | 201 | _errors += messages.minChecked.replace( '{count}', rules[1] )+'<br />'; |
202 | 202 | }else if( rules[0] === 'maxSelected' && !that.check.selectbox.maxSelected( _val, rules[1] ) ){ |
203 | 203 | _errors += messages.maxSelected.replace( '{count}', rules[1] )+'<br />'; |
|
256 | 256 | }, |
257 | 257 | // Equal check |
258 | 258 | equal : function( val, arg ){ |
259 | | - return ( $( this.form ).find( 'input[name='+ arg +']' ).val() !== val ) ? false : true; |
| 259 | + return ( $( this.form ).find( 'input[name="'+ arg +'"]' ).val() !== val ) ? false : true; |
260 | 260 | }, |
261 | 261 | /** |
262 | 262 | * Credit Card Control |
|
292 | 292 | return ( !_inp.checked ) ? false : true ; |
293 | 293 | }, |
294 | 294 | maxChecked : function( _inp, arg ){ |
295 | | - var count = $( this.form.querySelectorAll( 'input[type=checkbox][name='+ _inp.name +']' ) ).filter( ':checked' ).length ; |
| 295 | + var count = $( this.form.querySelectorAll( 'input[type=checkbox][name="'+ _inp.name +'"]' ) ).filter( ':checked' ).length ; |
296 | 296 | return ( count > arg ) ? false : true ; |
297 | 297 | }, |
298 | 298 | minChecked : function( _inp, arg ){ |
299 | | - var count = $( this.form.querySelectorAll( 'input[type=checkbox][name='+ _inp.name +']' ) ).filter( ':checked' ).length ; |
| 299 | + var count = $( this.form.querySelectorAll( 'input[type=checkbox][name="'+ _inp.name +'"]' ) ).filter( ':checked' ).length ; |
300 | 300 | return ( count < arg ) ? false : true ; |
301 | 301 | } |
302 | 302 | }, |
|
314 | 314 | }, |
315 | 315 | // Radio |
316 | 316 | radio : function ( _inp ) { |
317 | | - var count = $( this.form.querySelectorAll( 'input[type=radio][name='+ _inp.name +']' ) ).filter( ':checked' ).length ; |
| 317 | + var count = $( this.form.querySelectorAll( 'input[type=radio][name="'+ _inp.name +'"]' ) ).filter( ':checked' ).length ; |
318 | 318 | return ( count === 1 ) ? false : true ; |
319 | 319 | }, |
320 | 320 | // Custom reg check |
|
0 commit comments