hi everybody..
i'm creating a gadget which accesses a data base by calling a webservice, and then should display the result into the flyout..
here is my code:
gadget.html
<html>
<head>
<link href="inbox.css" rel="stylesheet" type="text/css" />
<script src="inbox.js" language="JavaScript"></script>
</head>
<script>
System.Gadget.settingsUI = "settings.html";
// init flyout file
System.Gadget.Flyout.file = "flyout.html";
</script>
<body onload="InitializeService()" id="service" style="behavior:url(webservice.htc)" onresult="ShowResult()">
<form name="Form">
<div align="center"><input id="TexteSaisieClient" name="TexteSaisieClient" type="text" SIZE="13" maxlength="60" /></div>
<div align="right"><button onclick="GetText()">Rechercher!</button></div>
</form>
</body>
</html>
we can see that it displays a field where we get a word, or even a letter, and the webservice performs a seek on to the database..
no here is the javascript code:
var iCallID;
var SaisieClient;
function GetText()
{
SaisieClient = document.Form.TexteSaisieClient.value;
iCallID = service.RechService.callService("Operation", SaisieClient);
}
function InitializeService()
{
service.useService("http://localhost/webservicetest/TestBaseVisualFox.asmx wsdl", "RechService");
}
function ShowResult()
{
if((event.result.error)&&(iCallID==event.result.id))
{
var xfaultcode = event.result.errorDetail.code;
var xfaultstring = event.result.errorDetail.string;
var xfaultsoap = event.result.errorDetail.raw;
document.write("il y a une erreur " + xfaultcode +" "+ xfaultstring +" "+ xfaultsoap + " " + event.result.value);
}
else
{
if((!event.result.error) && (iCallID == event.result.id))
{
System.Gadget.Flyout.file = "flyout.html";
System.Gadget.Flyout.show=true;
var flyoutDoc = System.Gadget.Flyout.document;
var reponse = event.result.value;
flyoutDoc.getElementById("txt").innerHTML = reponse; }
else
{
document.write("Il y a une autre erreur!");
}
}
}
the gettext function gets the text typed in by the user and calls the webservice, after having initialized it with the InitialiseService function.
and to finish, the flyout.html code:
<html>
<head>
<title>Inbox - Flyout</title>
<script src="inbox.js" language="javascript" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="inbox.css" />
</head>
<body>
resultat:
<div id="txt"></div>
</body>
</html>
So the "txt" item should be changed by the call of the function ShowResult() ...
Why does this stuff doesn't work
thanks for all