Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
	"http://www.w3.org/TR/html4/strict.dtd">
3
<html>
4
<head>
5
	<title>CheckBox Widget Demo</title>
6
 
7
	<script type="text/javascript" src="../../../dojo/dojo.js"
8
		djConfig="isDebug: true, parseOnLoad: true"></script>
9
	<script type="text/javascript" src="../_testCommon.js"></script>
10
 
11
	<script type="text/javascript">
12
		dojo.require("dijit.form.CheckBox");
13
		dojo.require("dojo.parser");	// find widgets
14
 
15
		function outputValues(form){
16
			var str = "";
17
			for(var i=0;i<form.elements.length;i++){
18
				var e = form.elements[i];
19
				if(e.type=="submit") break;
20
				if(e.checked){
21
					str += "submit: name="+e.name+" id="+e.id+" value="+e.value+ "<br>";
22
				}
23
			}
24
			dojo.byId("result").innerHTML = str;
25
			return false;
26
		}
27
 
28
		function reportChecked(checked) {
29
			dojo.byId("oncheckedoutput").innerHTML = checked;
30
		}
31
 
32
		function reportValueChanged(value) {
33
			dojo.byId("onvaluechangedoutput").innerHTML = value;
34
		}
35
 
36
		dojo.addOnLoad(function(){
37
			var params = {id: "cb6", name: "cb6"};
38
			var widget = new dijit.form.CheckBox(params, dojo.byId("checkboxContainer"));
39
			widget.setChecked(true);
40
		});
41
	</script>
42
	<style type="text/css">
43
		@import "../../../dojo/resources/dojo.css";
44
		@import "../css/dijitTests.css";
45
 
46
		label { margin-right: 0.80em; }
47
	</style>
48
</head>
49
<body>
50
	<h1 class="testTitle">Dijit CheckBox Test</h1>
51
	<p>
52
	Here are some checkboxes.  Try clicking, and hovering, tabbing, and using the space bar to select:
53
	</p>
54
	<!--  <form onSubmit="return outputValues(this);"> -->
55
	<form>
56
		<input type="checkbox" name="cb0" id="cb0" />
57
			<label for="cb0">cb0: Vanilla (non-dojo) checkbox (for comparison purposes)</label>
58
		<br>
59
		<input type="checkbox" name="cb1" id="cb1" value="foo" dojoType="dijit.form.CheckBox" onClick="console.log('clicked cb1')">
60
			<label for="cb1">cb1: normal checkbox, with value=foo, clicking generates console log messages</label>
61
		<br>
62
		<input onChange="reportChecked" type="checkbox" name="cb2" id="cb2" dojoType="dijit.form.CheckBox" checked="checked"/>
63
			<label for="cb2">cb2: normal checkbox, initially turned on.</label>
64
			<span>"onChange" handler updates: [<span id="oncheckedoutput"></span>]</span>
65
		<br>
66
		<input type="checkbox" name="cb3" id="cb3" dojoType="dijit.form.CheckBox" disabled="disabled">
67
			<label for="cb3">cb3: disabled checkbox</label>
68
		<br>
69
		<input type="checkbox" name="cb4" id="cb4" dojoType="dijit.form.CheckBox" disabled="disabled" checked="checked"/>
70
			<label for="cb4">cb4: disabled checkbox, turned on</label>
71
		<br>
72
		<input type="checkbox" name="cb5" id="cb5" />
73
			<label for="cb5">cb5: Vanilla (non-dojo) checkbox (for comparison purposes)</label>
74
		<br>
75
		<div id="checkboxContainer"></div>
76
			<label for="cb6">cb6: instantiated from script</label>
77
		<br>
78
		<input onChange="reportValueChanged" type="checkbox" name="cb7" id="cb7" dojoType="dijit.form.CheckBox">
79
			<label for="cb7">cb7: normal checkbox.</label>
80
			<input type="button" onclick='dijit.byId("cb7").setDisabled(true);' value="disable" />
81
			<input type="button" onclick='dijit.byId("cb7").setDisabled(false);' value="enable" />
82
			<input type="button" onclick='dijit.byId("cb7").setValue("fish");' value='set value to "fish"' />
83
			<span>"onChange" handler updates: [<span id="onvaluechangedoutput"></span>]</span>
84
		<br>
85
	<p>
86
	Here are some radio buttons.  Try clicking, and hovering, tabbing, and arrowing
87
	</p>
88
		<p>
89
			<span>Radio group #1:</span>
90
			<input type="radio" name="g1" id="g1rb1" value="news" dojoType="dijit.form.RadioButton">
91
			<label for="g1rb1">news</label>
92
			<input type="radio" name="g1" id="g1rb2" value="talk" dojoType="dijit.form.RadioButton" checked="checked"/>
93
			<label for="g1rb2">talk</label>
94
			<input type="radio" name="g1" id="g1rb3" value="weather" dojoType="dijit.form.RadioButton" disabled="disabled"/>
95
			<label for="g1rb3">weather</label>
96
		</p>
97
		<p>
98
			<span>Radio group #2: (no default value, and has breaks)</span><br>
99
			<input type="radio" name="g2" id="g2rb1" value="top40" dojoType="dijit.form.RadioButton"/>
100
			<label for="g2rb1">top 40</label><br>
101
			<input type="radio" name="g2" id="g2rb2" value="oldies" dojoType="dijit.form.RadioButton"/>
102
			<label for="g2rb2">oldies</label><br>
103
			<input type="radio" name="g2" id="g2rb3" value="country" dojoType="dijit.form.RadioButton"/>
104
			<label for="g2rb3">country</label><br>
105
			(Note if using keyboard: tab to navigate, and use arrow or space to select)
106
		</p>
107
		<p>
108
			<span>Radio group #3 (native radio buttons):</span>
109
			<input type="radio" name="g3" id="g3rb1" value="rock"/>
110
			<label for="g3rb1">rock</label>
111
			<input type="radio" name="g3" id="g3rb2" value="jazz" disabled="disabled"/>
112
			<label for="g3rb2">jazz</label>
113
			<input type="radio" name="g3" id="g3rb3" value="classical" checked="checked"/>
114
			<label for="g3rb3">classical</label>
115
		</p>
116
		<input type="submit" />
117
	</form>
118
 
119
	<!-- <p>Submitted data:</p>
120
	<div id="result"></div>
121
	 -->
122
</body>
123
</html>