diff options
author | 2008-11-13 09:49:11 +0000 | |
---|---|---|
committer | 2008-11-13 09:49:11 +0000 | |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dijit/tests/form/test_CheckBox.html | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | scuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz scuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.zip |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/tests/form/test_CheckBox.html')
-rw-r--r-- | includes/js/dijit/tests/form/test_CheckBox.html | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/includes/js/dijit/tests/form/test_CheckBox.html b/includes/js/dijit/tests/form/test_CheckBox.html new file mode 100644 index 0000000..4358270 --- /dev/null +++ b/includes/js/dijit/tests/form/test_CheckBox.html @@ -0,0 +1,127 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <title>CheckBox Widget Demo</title> + + <style type="text/css"> + @import "../../../dojo/resources/dojo.css"; + @import "../css/dijitTests.css"; + + label { margin-right: 0.80em; } + </style> + + <script type="text/javascript" src="../../../dojo/dojo.js" + djConfig="isDebug: true, parseOnLoad: true"></script> + <script type="text/javascript" src="../_testCommon.js"></script> + + <script type="text/javascript"> + dojo.require("dijit.form.CheckBox"); + dojo.require("dojo.parser"); // find widgets + + function outputValues(form){ + var str = ""; + for(var i=0;i<form.elements.length;i++){ + var e = form.elements[i]; + if(e.type=="submit") break; + if(e.checked){ + str += "submit: name="+e.name+" id="+e.id+" value="+e.value+ "<br>"; + } + } + dojo.byId("result").innerHTML = str; + return false; + } + + function reportChecked(checked) { + dojo.byId("oncheckedoutput").innerHTML = checked; + } + + function reportValueChanged(value) { + dojo.byId("onvaluechangedoutput").innerHTML = value; + } + + dojo.addOnLoad(function(){ + var params = {id: "cb6", name: "cb6"}; + var widget = new dijit.form.CheckBox(params, dojo.byId("checkboxContainer")); + widget.setAttribute('checked', true); + }); + </script> +</head> +<body> + <h1 class="testTitle">Dijit CheckBox Test</h1> + <p> + Here are some checkboxes. Try clicking, and hovering, tabbing, and using the space bar to select: + </p> + <!-- <form onSubmit="return outputValues(this);"> --> + <!-- to test form submission, you'll need to create an action handler similar to + http://www.utexas.edu/teamweb/cgi-bin/generic.cgi --> + <form> + <input type="checkbox" name="cb0" id="cb0" /> + <label for="cb0">cb0: Vanilla (non-dojo) checkbox (for comparison purposes)</label> + <br> + <input type="checkbox" name="cb1" id="cb1" value="foo" dojoType="dijit.form.CheckBox" onClick="console.log('clicked cb1')"> + <label for="cb1">cb1: normal checkbox, with value=foo, clicking generates console log messages</label> + <br> + <input onChange="reportChecked" type="checkbox" name="cb2" id="cb2" dojoType="dijit.form.CheckBox" checked="checked"/> + <label for="cb2">cb2: normal checkbox, initially turned on.</label> + <span>"onChange" handler updates: [<span id="oncheckedoutput"></span>]</span> + <br> + <input type="checkbox" name="cb3" id="cb3" dojoType="dijit.form.CheckBox" disabled="disabled"> + <label for="cb3">cb3: disabled checkbox</label> + <br> + <input type="checkbox" name="cb4" id="cb4" dojoType="dijit.form.CheckBox" disabled="disabled" checked="checked"/> + <label for="cb4">cb4: disabled checkbox, turned on</label> + <br> + <input type="checkbox" name="cb5" id="cb5" /> + <label for="cb5">cb5: Vanilla (non-dojo) checkbox (for comparison purposes)</label> + <br> + <div id="checkboxContainer"></div> + <label for="cb6">cb6: instantiated from script</label> + <br> + <input onChange="reportValueChanged" type="checkbox" name="cb7" id="cb7" dojoType="dijit.form.CheckBox"> + <label for="cb7">cb7: normal checkbox.</label> + <input type="button" onclick='dijit.byId("cb7").setAttribute("disabled",true);' value="disable" /> + <input type="button" onclick='dijit.byId("cb7").setAttribute("disabled",false);' value="enable" /> + <input type="button" onclick='dijit.byId("cb7").setValue("fish");' value='set value to "fish"' /> + <input type="button" onclick='dijit.byId("cb7").reset();' value='Reset value+checked' /> + <span>"onChange" handler updates: [<span id="onvaluechangedoutput"></span>]</span> + <br> + <p> + Here are some radio buttons. Try clicking, and hovering, tabbing, and arrowing + </p> + <p> + <span>Radio group #1:</span> + <input type="radio" name="g1" id="g1rb1" value="news" dojoType="dijit.form.RadioButton"> + <label for="g1rb1">news</label> + <input type="radio" name="g1" id="g1rb2" value="talk" dojoType="dijit.form.RadioButton" checked="checked"/> + <label for="g1rb2">talk</label> + <input type="radio" name="g1" id="g1rb3" value="weather" dojoType="dijit.form.RadioButton" disabled="disabled"/> + <label for="g1rb3">weather</label> + </p> + <p> + <span>Radio group #2: (no default value, and has breaks)</span><br> + <input type="radio" name="g2" id="g2rb1" value="top40" dojoType="dijit.form.RadioButton"/> + <label for="g2rb1">top 40</label><br> + <input type="radio" name="g2" id="g2rb2" value="oldies" dojoType="dijit.form.RadioButton"/> + <label for="g2rb2">oldies</label><br> + <input type="radio" name="g2" id="g2rb3" value="country" dojoType="dijit.form.RadioButton"/> + <label for="g2rb3">country</label><br> + (Note if using keyboard: tab to navigate, and use arrow or space to select) + </p> + <p> + <span>Radio group #3 (native radio buttons):</span> + <input type="radio" name="g3" id="g3rb1" value="rock"/> + <label for="g3rb1">rock</label> + <input type="radio" name="g3" id="g3rb2" value="jazz" disabled="disabled"/> + <label for="g3rb2">jazz</label> + <input type="radio" name="g3" id="g3rb3" value="classical" checked="checked"/> + <label for="g3rb3">classical</label> + </p> + <input type="submit" /> + </form> + + <!-- <p>Submitted data:</p> + <div id="result"></div> + --> +</body> +</html> |