| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <meta http-equiv="pragma" content="no-cache" /> |
| 7 | <meta http-equiv="expires" content="-1" /> |
| 8 | <title>test ListInput</title> |
| 9 | <style type="text/css" title="text/css"> |
| 10 | @import "../../../dojo/resources/dojo.css"; |
| 11 | @import "../../../dijit/themes/dijit.css"; |
| 12 | @import "../../../dijit/tests/css/dijitTests.css"; |
| 13 | @import "../../../dijit/themes/tundra/tundra.css"; |
| 14 | |
| 15 | @import "../../../dojox/form/resources/ListInput.css"; |
| 16 | |
| 17 | </style> |
| 18 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="debugAtAllCost:true,isDebug: true,parseOnLoad:true"></script> |
| 19 | |
| 20 | <script type="text/javascript"> |
| 21 | dojo.require("dojo.parser"); |
| 22 | dojo.require("dijit.layout.TabContainer"); |
| 23 | dojo.require("dijit.layout.ContentPane"); |
| 24 | dojo.require("dijit.form.Button"); |
| 25 | var current="list_0"; |
| 26 | dojo.addOnLoad(function(){ |
| 27 | dojo.connect(tabC,"selectChild",function(pageId) { |
| 28 | current=(typeof pageId=="object")?pageId.id:pageId; |
| 29 | current="list_" + current.split("_").pop(); |
| 30 | }); |
| 31 | }); |
| 32 | |
| 33 | |
| 34 | //test beginning |
| 35 | dojo.require("dojox.form.ListInput"); |
| 36 | dojo.require("dojox.validate.regexp"); |
| 37 | |
| 38 | |
| 39 | getValues=function() { |
| 40 | console.warn(window[current].get("value")); |
| 41 | }; |
| 42 | getValuesMatch=function() { |
| 43 | console.warn(window[current].get("MatchedValue")); |
| 44 | }; |
| 45 | getValuesMisMatch=function() { |
| 46 | console.warn(window[current].get("MismatchedValue")); |
| 47 | }; |
| 48 | |
| 49 | disable=function(disable) { |
| 50 | window[current].set("disabled",disable); |
| 51 | }; |
| 52 | reset=function() { |
| 53 | window[current].reset(); |
| 54 | }; |
| 55 | undo=function() { |
| 56 | window[current].undo(); |
| 57 | }; |
| 58 | |
| 59 | addedVal=0; |
| 60 | addValue=function() { |
| 61 | window[current].add("new item " + (++addedVal)); |
| 62 | }; |
| 63 | addValues=function() { |
| 64 | var vals=[]; |
| 65 | for (var i=0;i<3;i++) { |
| 66 | vals.push("new item " + (++addedVal)); |
| 67 | } |
| 68 | window[current].add(vals); |
| 69 | }; |
| 70 | </script> |
| 71 | </head> |
| 72 | <body class="tundra"> |
| 73 | <h1>ListInput</h1> |
| 74 | <div> |
| 75 | <a href="dl.php?file=dojox/form/ListInput.js">Download ListInput.js</a><br /> |
| 76 | <a href="dl.php?file=dojox/form/resources/ListInput.css">Download ListInput.css</a><br /> |
| 77 | </div> |
| 78 | |
| 79 | <blockquote> |
| 80 | Enter some element in the list. <br /> |
| 81 | Separate them by comma or just press enter |
| 82 | </blockquote> |
| 83 | |
| 84 | <h1>Actions</h1> |
| 85 | <a dojoType="dijit.form.Button" onclick="disable(true);">Disable</a> |
| 86 | <a dojoType="dijit.form.Button" onclick="disable(false);">Enable</a> |
| 87 | <a dojoType="dijit.form.Button" onclick="undo();">Undo</a> |
| 88 | <a dojoType="dijit.form.Button" onclick="reset();">Reset</a> |
| 89 | <a dojoType="dijit.form.Button" onclick="addValue();">Add an item</a> |
| 90 | <a dojoType="dijit.form.Button" onclick="addValues();">Add 3 items</a> |
| 91 | <a dojoType="dijit.form.Button" onclick="getValues();">See all values in firebug</a> |
| 92 | <a dojoType="dijit.form.Button" onclick="getValuesMatch();">See validated values in firebug</a> |
| 93 | <a dojoType="dijit.form.Button" onclick="getValuesMisMatch();">See unvalidated values in firebug</a> |
| 94 | |
| 95 | <h1>Demos</h1> |
| 96 | <div data-dojo-id="tabC" dojoType="dijit.layout.TabContainer" tabStrip="true" style="width: 100%; height:300px;"> |
| 97 | <div dojoType="dijit.layout.ContentPane" title="Demo 1"> |
| 98 | <h1>With inputbox and editable items</h1> |
| 99 | |
| 100 | <blockquote> |
| 101 | note : you can move between all editable area with left and right arrow.<br /> |
| 102 | This feature can be desactivated |
| 103 | </blockquote> |
| 104 | |
| 105 | <div value="initial item 1" data-dojo-id="list_0" name="list" dojoType="dojox.form.ListInput"></div> |
| 106 | </div> |
| 107 | <div dojoType="dijit.layout.ContentPane" title="Demo 2"> |
| 108 | <h1>Without inputbox and with editable items</h1> |
| 109 | |
| 110 | <blockquote> |
| 111 | note : you can move between all editable area with left and right arrow<br /> |
| 112 | This feature can be desactivated |
| 113 | </blockquote> |
| 114 | |
| 115 | <div value="initial item 1" data-dojo-id="list_1" readOnlyInput="true" dojoType="dojox.form.ListInput"></div> |
| 116 | </div> |
| 117 | <div dojoType="dijit.layout.ContentPane" title="Demo 3"> |
| 118 | <h1>Without initial value</h1> |
| 119 | <div data-dojo-id="list_2" dojoType="dojox.form.ListInput"></div> |
| 120 | </div> |
| 121 | <div dojoType="dijit.layout.ContentPane" title="Demo 4"> |
| 122 | <h1>With inputbox and without editable items</h1> |
| 123 | <div value="initial item 1" data-dojo-id="list_3" readOnlyItem="true" dojoType="dojox.form.ListInput"></div> |
| 124 | </div> |
| 125 | <div dojoType="dijit.layout.ContentPane" title="Demo 5"> |
| 126 | <h1>Without inputbox and without editable items</h1> |
| 127 | <div value="initial item 1" data-dojo-id="list_4" readOnlyItem="true" readOnlyInput="true" dojoType="dojox.form.ListInput"></div> |
| 128 | </div> |
| 129 | <div dojoType="dijit.layout.ContentPane" title="Demo 6"> |
| 130 | <h1>With validation</h1> |
| 131 | <blockquote> |
| 132 | note : enter only digits |
| 133 | </blockquote> |
| 134 | <div value="1234" data-dojo-id="list_5" regExp="[0-9]+" dojoType="dojox.form.ListInput"></div> |
| 135 | </div> |
| 136 | <div dojoType="dijit.layout.ContentPane" title="Demo 7"> |
| 137 | <h1>With custom separator</h1> |
| 138 | <blockquote> |
| 139 | note : you can use semi-colon for separate item<br /> |
| 140 | You also can use an array of separators |
| 141 | </blockquote> |
| 142 | <div value="initial item 1" data-dojo-id="list_6" delimiter=";" dojoType="dojox.form.ListInput"></div> |
| 143 | </div> |
| 144 | <div dojoType="dijit.layout.ContentPane" title="Demo 8"> |
| 145 | <h1>With a submit form</h1> |
| 146 | <blockquote> |
| 147 | note : after submit, see url |
| 148 | </blockquote> |
| 149 | <form action="?" method="get"> |
| 150 | <div value="initial item 1" name="demo8" data-dojo-id="list_7" dojoType="dojox.form.ListInput"></div> |
| 151 | <input type="submit" /> |
| 152 | </form> |
| 153 | </div> |
| 154 | <div dojoType="dijit.layout.ContentPane" title="Demo 9"> |
| 155 | <h1>With a submit form - submit only validated value</h1> |
| 156 | <blockquote> |
| 157 | note : after submit, see url<br /> |
| 158 | enter only digits |
| 159 | </blockquote> |
| 160 | <form action="?" method="get"> |
| 161 | <div name="demo9" data-dojo-id="list_8" value="invalid value,1234" regExp="[0-9]+" submitOnlyValidValue="true" dojoType="dojox.form.ListInput"></div> |
| 162 | <input type="submit" /> |
| 163 | </form> |
| 164 | </div> |
| 165 | <div dojoType="dijit.layout.ContentPane" title="Demo 10"> |
| 166 | <h1>With a max number of items</h1> |
| 167 | <blockquote> |
| 168 | note : you can only add 3 items |
| 169 | </blockquote> |
| 170 | <div value="initial item 1" data-dojo-id="list_9" maxItems="3" dojoType="dojox.form.ListInput"></div> |
| 171 | </div> |
| 172 | <div dojoType="dijit.layout.ContentPane" title="Demo 11"> |
| 173 | <h1>Without close button</h1> |
| 174 | <blockquote> |
| 175 | note : you can specify if you want close button : <br /> |
| 176 | - only on validated value<br /> |
| 177 | - only on unvalidated value<br /> |
| 178 | - never<br /> |
| 179 | - always<br /> |
| 180 | </blockquote> |
| 181 | <div data-dojo-id="list_10" showCloseButtonWhenValid="false" showCloseButtonWhenInvalid="false" dojoType="dojox.form.ListInput"></div> |
| 182 | </div> |
| 183 | <div dojoType="dijit.layout.ContentPane" title="Demo 12"> |
| 184 | <h1>Without anim</h1> |
| 185 | <div value="initial item 1" data-dojo-id="list_11" useAnim="false" dojoType="dojox.form.ListInput"></div> |
| 186 | </div> |
| 187 | </div> |
| 188 | </body> |
| 189 | </html> |