UNPKG

3.1 kBHTMLView Raw
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4 <title>Dojo DnD form test</title>
5 <style type="text/css">
6 @import "../../resources/dojo.css";
7 @import "../../resources/dnd.css";
8 @import "dndDefault.css";
9
10 body {
11 padding: 1em;
12 background:#ededed;
13 }
14
15 #container1,#container2 { width:300px; display:block; }
16 .clear { clear:both; }
17
18 </style>
19
20 <script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug: true"></script>
21 <script type="text/javascript">
22 require(["dojo/parser", "dojo/dnd/Source", "dojo/dnd/Target", "dojo/topic", "dojo/domReady!"], function(parser, Source, Target, topic){
23 parser.parse();
24
25 var c1, c2;
26
27 c1 = new Source("container1");
28 c1.insertNodes(false, [1, 2, 3, 4, 5, 6, [1, 2, 3], function(x){ return x + x; }]);
29 c2 = new Target("container2", {accept: ["money"]});
30
31 // example subscribe to events
32 topic.subscribe("/dnd/start",function(foo){
33 console.debug(foo);
34 });
35 });
36 </script>
37</head>
38<body>
39 <h1 class="testTitle">Dojo DnD form test</h1>
40
41 <p>This is a test to confirm that the DnD container does not interfere with form elements.</p>
42
43 <div id="dragLists">
44
45 <div style="float:left; margin:5px; ">
46 <h3>Target 1</h3>
47 <p id="container1" class="container"></p>
48 </div>
49
50 <div style="float:left; margin:5px; ">
51 <h3>Target 2: form controls galore</h3>
52 <form id="container2" class="container" action="http://dojotoolkit.org">
53 Input text: <input type="text" /><br />
54 Input checkbox: <input type="checkbox" /><br />
55 Input radio: <input type="radio" /><br />
56 Input password: <input type="password" /><br />
57 Input file: <input type="file" /><br />
58 Input button: <input type="button" value="Button" /><br />
59 Input reset: <input type="reset" /><br />
60 Input submit: <input type="submit" /><br />
61 Input image: <input type="image" src="http://dojotoolkit.org/images/logo.png" /><br />
62 Button: <button>Button</button><br />
63 Select: <select><option>Yes</option><option>No</option></select><br />
64 Textarea: <textarea cols="20" rows="3">Some text.</textarea>
65 </form>
66 </div>
67 <div class="clear"></div>
68 </div>
69
70 <p>&nbsp;</p>
71
72 <div data-dojo-type="dojo/dnd/Source" class="container">
73 <div>Source with <strong>skipForm = false</strong> (by default)</div>
74 <div class="dojoDndItem">Item <strong>X</strong>: <input type="text" value="1" /></div>
75 <div class="dojoDndItem">Item <strong>Y</strong>: <input type="text" value="2" /></div>
76 <div class="dojoDndItem">Item <strong>Z</strong>: <input type="text" value="3" /></div>
77 </div>
78
79 <p>&nbsp;</p>
80
81 <div data-dojo-type="dojo/dnd/Source" class="container" skipForm="true">
82 <div>Source with <strong>skipForm = true</strong></div>
83 <div class="dojoDndItem">Item <strong>A</strong>: <input type="text" value="a" /></div>
84 <div class="dojoDndItem">Item <strong>B</strong>: <input type="text" value="b" /></div>
85 <div class="dojoDndItem">Item <strong>C</strong>: <input type="text" value="c" /></div>
86 </div>
87
88 <p>HTML after</p>
89
90</body>
91</html>