Bonjour à tous !
Je suis pas à pas le tuto dojo.
Voici un exemple donné avec des boîtes de dialogue comportant des champs date et heure:
Et bien au retour, les dates et le temps sont toujours vides.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
71
72
73 <html> <head> <title>Dojo example</title> <style type="text/css"> @import "dijit/themes/nihilo/nihilo.css"; </style> <script type="text/javascript" src="dojo/dojo.js" djConfig="parseOnLoad:true, isDebug: true"></script> <script type="text/javascript"> dojo.require("dijit.form.Button"); dojo.require("dijit.Dialog"); dojo.require("dijit.form.TextBox"); dojo.require("dijit.form.DateTextBox"); dojo.require("dijit.form.TimeTextBox"); dojo.addOnLoad(function(){ formDlg = dijit.byId("formDialog"); // connect to the button so we display the dialog on click: dojo.connect(dijit.byId("buttonThree"), "onClick", formDlg, "show"); }); function checkData(){ var data = formDlg.attr('value'); console.log(data); if(data.sdate > data.edate){ alert("Start date must be before end date"); return false; }else{ return true; } } </script> <body class="nihilo"> <div dojoType="dijit.Dialog" id="formDialog" title="Form Dialog" execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));"> <table> <tr> <td><label for="name">Name: </label></td> <td><input dojoType=dijit.form.TextBox type="text" name="name" id="name"></td> </tr> <tr> <td><label for="loc">Location: </label></td> <td><input dojoType=dijit.form.TextBox type="text" name="loc" id="loc"></td> </tr> <tr> <td><label for="sdate">Start date: </label></td> <td><input dojoType=dijit.form.DateTextBox name="sdate" id="sdate"></td> </tr> <tr> <td><label for="edate">End date: </label></td> <td><input dojoType=dijit.form.DateTextBox name="edate" id="edate"></td> </tr> <tr> <td><label for="time">Time: </label></td> <td><input dojoType=dijit.form.TimeTextBox name="time" id="time"></td> </tr> <tr> <td><label for="desc">Description: </label></td> <td><input dojoType=dijit.form.TextBox type="text" name="desc" id="desc"></td> </tr> <tr> <td colspan="2" align="center"> <button dojoType=dijit.form.Button type="submit" onSubmit="return checkData();">OK</button> </td> </tr> </table> </div> <p>When pressing this button the dialog will popup:</p> <button id="buttonThree" dojoType="dijit.form.Button">Show me!</button> </body> </html>
Affichées comme des structures JSON {} et le test de comparaison n'est pas fait, alors que les champs texte "normaux" sont parfaitement renseignés.
Quelqu'un connait-il ce problème ?
Rien trouvé avec Google.







Répondre avec citation
Partager