-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
70 lines (60 loc) · 3.06 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<!--[if lt IE 7 ]> <html class="ie6 lte8"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7 lte8"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8 lte8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html>
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Knockout Dynamic Forms</title>
<script src="global/js/knockout-3.0.0.js"></script>
<script src="global/js/knockout.validation.js"></script>
<script>
var JSONUrl = 'global/stub/stub.json';
</script>
<script src="global/js/knockout-functions.js"></script>
<link href="global/css/form.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="display: none;" data-bind="visible: true">
<form id="" action="" data-bind="foreach: Fields" class="ym-form">
<!--ko if: $parent.HiddenElements().indexOf(Name()) == -1 -->
<div class="ym-fbox" data-bind="css:'ym-fbox-'+Type()">
<!--ko if: Element() !== "button" && Type() !== "submit" -->
<label data-bind="text: Name, attr: {for:Name}"></label>
<!--/ko-->
<!--ko if: Element() === "select" -->
<select data-bind="options: Options, attr: {id:Name}, value:Value, optionsCaption : $root.IsNullOrEmpty(Placeholder()) == true? 'Choose One' : Placeholder()"></select>
<!--/ko-->
<!--ko if: Element() === "input" && Type() === "checkbox" -->
<!-- ko foreach: Options -->
<input type="checkbox" data-bind="checkedValue: $data, checked: $parent.Value" />
<span data-bind="text: $data"></span>
<!-- /ko -->
<!--/ko-->
<!--ko if: Element() === "input" && Type() === "radio" -->
<!-- ko foreach: Options -->
<input type="radio" data-bind="checkedValue: $data, checked: $parent.Value" />
<span data-bind="text: $data"></span>
<!-- /ko -->
<!--/ko-->
<!--ko if: Element() === "input" && Type() !== "radio" && Type() !== "checkbox" && Type() !== "submit" -->
<input data-bind="attr: {id:Name, type:Type, placeholder:Placeholder }, value:Value "></input>
<!--/ko-->
<!--ko if: Element() === "textarea" -->
<textarea data-bind="attr: {id:Name, placeholder:Placeholder, value:Value}, value:Value"></textarea>
<!--/ko-->
<!--ko if: Element() === "input" && Type() === "submit" -->
<input data-bind=" attr: {id:Name, type:Type, value: Value}, click: $root.SaveForm"></input>
<!--/ko-->
<!--ko if: Element() === "button" -->
<button data-bind="attr: {id:Name}"><span data-bind="text: Value, click: $root.SaveForm"></span></button>
<!--/ko-->
</div>
<!--/ko-->
</form>
</div>
</body>
</html>