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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<?php include 'class/connectionBD.php';
$conn = new connexionBD();
$conn->connexion();
?>
<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" href="js/dijit/themes/claro/claro.css">
<script>dojoConfig = {async: true}</script><script src='js/dojo/dojo.js'></script>
<?php
include 'outils/toolBox.php';
$requete="SELECT libelleCentrale,libelleCentrale as libcen FROM centrale";
$chemin ="tmp";
$nomselect ="selectCentrale.json";
$libelleattribut1 = "libellecentrale";
$libelleattribut2 = "libcen";
createJsonFile($requete,$chemin,$nomselect,$libelleattribut1,$libelleattribut2);
?>
<script>require(["dijit/form/Select",
"dojo/data/ObjectStore",
"dojo/store/Memory"
], function(Select, ObjectStore, Memory){
var store = new Memory({
<?php require 'tmp/selectCentrale.json'; ?>
});
var os = new ObjectStore({ objectStore: store });
var s = new Select({
store: os
}, "target");
s.startup();
s.on("change", function(){
var valeur =dijit.byId('target').get('value')
document.admin.cibleCentrale.value = valeur;
})
})</script>
</head>
<body class="claro">
<form name="admin" id="admin">
<div id="target" name="target"></div>
<input type="text" name= "cibleCentrale" id ="cibleCentrale" style="width: 80px ;">
<input type="text" name= "modifCentrale" id ="modifCentrale" style="width: 80px">
<div id="svrMessage">message du serveur</div>
<button type="submit" >Modifier</button>
<!-- ---------------------------------------------------------------------------------------------------------------------------------
// Traitement ajax
/---------------------------------------------------------------------------------------------------------------------------------- -->
<script>
require(["dojo/dom", "dojo/on", "dojo/request", "dojo/dom-form"],
function(dom, on, request, domForm){
var form = dom.byId('admin');
// Attach the onsubmit event handler of the form
on(form, "submit", function(evt){
// prevent the page from navigating after submit
evt.stopPropagation();
evt.preventDefault();
// Post the data to the server
request.post("test1.php", {
// Send the username and password
data: domForm.toObject("admin"),
}).then(function(response){
dom.byId('svrMessage').innerHTML = response;
});
});
}
); </script>
<!-- -------------------------------------------------------------------------------------------------------------------------------
// Fin traitement ajax
//-------------------------------------------------------------------------------------------------------------------------------- -->
<?php $conn->deconnexion(); ?>
</form>
</body>
</html> |
Partager