File tree Expand file tree Collapse file tree 7 files changed +95
-8
lines changed
Expand file tree Collapse file tree 7 files changed +95
-8
lines changed Original file line number Diff line number Diff line change @@ -799,6 +799,21 @@ var IT = (function () {
799799 } ) ;
800800 return valid ;
801801 }
802+ } , {
803+ key : "validate2" ,
804+ value : function validate2 ( ) {
805+ this . content . valid ( ) ;
806+
807+ var setsDeep = function setsDeep ( arr ) {
808+ $ . each ( arr , function ( i , l ) {
809+ if ( typeof l . val == "function" && l . className != "checkbox" && l . className != "radio" ) {
810+ console . info ( l ) ;
811+ } else if ( l . items ) setsDeep ( l . items ) ;
812+ } ) ;
813+ } ;
814+
815+ setsDeep ( this . items ) ;
816+ }
802817 } , {
803818 key : "submit" ,
804819 value : function submit ( ) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44"description" : " Javascript UI Framework For Common Browser" ,
55"dependencies" : {
66"jquery" : " ^3.3.1" ,
7- "jquery-form" : " ^4.2.2"
7+ "jquery-form" : " ^4.2.2" ,
8+ "jquery-validation" : " ^1.19.0"
89},
910"scripts" : {
1011"js:compile" : " rollup -c -w" ,
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="UTF-8 ">
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7+ < meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
8+ < title > Document</ title >
9+ < script src ="../node_modules/jquery/dist/jquery.min.js "> </ script >
10+ < script src ="../node_modules/jquery-validation/dist/jquery.validate.min.js "> </ script >
11+ </ head >
12+
13+ < body >
14+ < form class ="cmxform " id ="commentForm " method ="get " action ="">
15+ < fieldset >
16+ < legend > Please provide your name, email address (won't be published) and a comment</ legend >
17+ < p >
18+ < label for ="cname "> Name (required, at least 2 characters)</ label >
19+ < input id ="cname " name ="name " type ="text " required >
20+ </ p >
21+ < p >
22+ < label for ="cemail "> E-Mail (required)</ label >
23+ < input id ="cemail " type ="email " name ="email " required >
24+ </ p >
25+ < p >
26+ < label for ="curl "> URL (optional)</ label >
27+ < input id ="curl " type ="url " name ="url ">
28+ </ p >
29+ < p >
30+ < label for ="ccomment "> Your comment (required)</ label >
31+ < textarea id ="ccomment " name ="comment " required > </ textarea >
32+ </ p >
33+ < p >
34+ <!--<input class="submit" type="submit" value="Submit">-->
35+ < button id ="test "> Test</ button >
36+ </ p >
37+ </ fieldset >
38+ </ form >
39+ < script >
40+ $ ( function ( ) {
41+ $ ( '#test' ) . click ( function ( ) {
42+ $ ( "#commentForm" ) . validate ( {
43+ rules : {
44+ name : {
45+ minlength : 3
46+ }
47+ }
48+ } ) ;
49+ } ) ;
50+ //$("#commentForm").validate();
51+ } ) ;
52+ </ script >
53+
54+ </ body >
55+
56+ </ html >
Original file line number Diff line number Diff line change @@ -127,6 +127,18 @@ export default class Form extends Component {
127127
128128return valid ;
129129}
130+ validate2 ( ) {
131+ this . content . valid ( ) ;
132+
133+ let setsDeep = function ( arr ) {
134+ $ . each ( arr , function ( i , l ) {
135+ if ( typeof l . val == "function" && l . className != "checkbox" && l . className != "radio" ) {
136+ console . info ( l ) ;
137+ } else if ( l . items ) setsDeep ( l . items ) ;
138+ } ) ;
139+ }
140+ setsDeep ( this . items ) ;
141+ }
130142submit ( options = null ) {
131143let me = this ;
132144if ( options == null ) me . content . submit ( ) ;
Original file line number Diff line number Diff line change 99 < link rel ="stylesheet " href ="../dist/it-framework.min.css ">
1010
1111 < script src ="../node_modules/jquery/dist/jquery.min.js "> </ script >
12+ < script src ="../node_modules/jquery-validation/dist/jquery.validate.min.js "> </ script >
1213 < script src ="../node_modules/jquery-form/dist/jquery.form.min.js "> </ script >
1314
1415 <!-- <script src="../dist/it-framework.all.js"></script> Editable Version -->
1516 <!-- <script src="../dist/it-framework.min.js"></script> Compressed Version -->
16-
17- < script src ="../dist/it-framework.min .js "> </ script >
17+
18+ < script src ="../dist/it-framework.all .js "> </ script >
1819 < script >
1920 $ ( function ( ) {
2021 var button = new IT . Button ( ) ;
8687 items : [ {
8788 label : 'Kode' ,
8889 name : 'kode' ,
89- xtype : 'textbox'
90+ xtype : 'textbox' ,
9091 } ,
9192 {
9293 label : 'Nama' ,
9394 name : 'nama' ,
94- xtype : 'textbox'
95+ xtype : 'textbox' ,
9596 } ,
9697 select ,
9798 {
9899 xtype : 'button' ,
99- text : 'Form Button Test'
100+ text : 'Form Button Test' ,
101+ handler : ( ) => {
102+ form . validate2 ( ) ;
103+ }
100104 }
101105 ]
102106 } ) ;
You can’t perform that action at this time.
0 commit comments