File tree Expand file tree Collapse file tree 2 files changed +86
-4
lines changed
Expand file tree Collapse file tree 2 files changed +86
-4
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta http-equiv ="Content-type " content ="text/html; charset=utf-8 " />
5+ < title > JQuery Validation Engine</ title >
6+ < link rel ="stylesheet " href ="../css/validationEngine.jquery.css " type ="text/css "/>
7+ < link rel ="stylesheet " href ="../css/template.css " type ="text/css "/>
8+ < script src ="../js/jquery-1.8.2.min.js " type ="text/javascript ">
9+ </ script >
10+ < script src ="../js/languages/jquery.validationEngine-en.js " type ="text/javascript " charset ="utf-8 ">
11+ </ script >
12+ < script src ="../js/jquery.validationEngine.js " type ="text/javascript " charset ="utf-8 ">
13+ </ script >
14+ < script >
15+ jQuery ( document ) . ready ( function ( ) {
16+ jQuery ( "#formID2" ) . validationEngine ( {
17+ notEmpty : true
18+ } )
19+ } ) ;
20+ </ script >
21+ </ head >
22+ < body >
23+
24+ < p > onValidationComplete stop the submit and let you handle the form after the validation</ p >
25+ < form id ="formID2 " class ="formular " method ="post " action ="">
26+ < fieldset >
27+ < legend >
28+ Phone
29+ </ legend >
30+ < label >
31+ +103-304-340-4300-043
32+ < br />
33+ +1 305 768 23 34 ext 23
34+ < br />
35+ +1 (305) 768-2334 extension 703
36+ < br />
37+ +1 (305) 768-2334 x703
38+ < br />
39+ 04312 / 777 777
40+ < br />
41+ 01-47.34/32 56
42+ < br />
43+ (01865) 123456
44+ < br />
45+ < span > Phone : </ span >
46+ < input value ="" class ="validate[required,custom[phone]] text-input " type ="text " name ="telephone " id ="telephone " />
47+ </ label >
48+ </ fieldset >
49+ < fieldset >
50+ < legend >
51+ OnlyLetter
52+ </ legend >
53+ < label >
54+ < span > only ascii letters, space and '</ span >
55+ < input value ="this is an invalid char '.' " class ="validate[required,custom[onlyLetterSp]] text-input " type ="text " name ="onlyascii " id ="onlyascii " />
56+ </ label >
57+ </ fieldset > < input class ="submit " type ="submit " value ="Validate & Send the form! "/> < hr />
58+ </ form >
59+
60+
61+ </ body >
62+ </ html >
Original file line number Diff line number Diff line change 235235 if ( ! options )
236236 options = methods . _saveOptions ( form , options ) ;
237237 options . eventTrigger = "field" ;
238- // validate the current field
239- window . setTimeout ( function ( ) {
240- methods . _validateField ( field , options ) ;
241- } , ( event . data ) ? event . data . delay : 0 ) ;
238+
239+ if ( options . notEmpty == true ) {
240+
241+ if ( field . val ( ) . length > 0 ) {
242+ // validate the current field
243+ window . setTimeout ( function ( ) {
244+ methods . _validateField ( field , options ) ;
245+ } , ( event . data ) ? event . data . delay : 0 ) ;
246+
247+ }
248+
249+ } else {
250+
251+ // validate the current field
252+ window . setTimeout ( function ( ) {
253+ methods . _validateField ( field , options ) ;
254+ } , ( event . data ) ? event . data . delay : 0 ) ;
255+
256+ }
257+
258+
259+
242260
243261 } ,
244262 /**
20492067 custom_error_messages :{ } ,
20502068 // true if you want to validate the input fields on blur event
20512069 binded : true ,
2070+ // set to true if you want to validate the input fields on blur only if the field it's not empty
2071+ notEmpty : false ,
20522072 // set to true, when the prompt arrow needs to be displayed
20532073 showArrow : true ,
20542074 // set to false, determines if the prompt arrow should be displayed when validating
You can’t perform that action at this time.
0 commit comments