Skip to content

Commit fc3a452

Browse files
2 parents 794aa80 + 350cc71 commit fc3a452

File tree

7 files changed

+95
-8
lines changed

7 files changed

+95
-8
lines changed

dist/it-framework.all.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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() {

dist/it-framework.all.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/it-framework.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
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",

src/form.html

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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>

src/js/lib/Form.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ export default class Form extends Component {
127127

128128
return 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+
}
130142
submit(options = null) {
131143
let me = this;
132144
if (options == null) me.content.submit();

src/sample.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
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();
@@ -86,17 +87,20 @@
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
});

0 commit comments

Comments
 (0)