|
Hi there,
I'm green with qooxdoo. I find it easy to build
windows etc but am having trouble in understanding how to use the Ajax Transport
layers, so this code will probably roll a few eyes as my only source of
reference has been the API and pulling the examples to peices to see what does
what.
This window I am making is for logging
into a page. At present, all I want it to do is run a php file when the Login
button is clicked and return the output of the file (at the moment, the php file
is just echo 'hello';)
**Start Code**
qx.core.Init.getInstance().defineMain(function()
{ // Create an object to hold the page instance var d = qx.ui.core.ClientDocument.getInstance(); // Create the Login Window var w2 = new qx.ui.window.Window(" FTM Booking System - Home", "icon/16/applications.png"); w2.setSpace("auto", 250, "auto", 200); w2.setCentered(true) d.add(w2); // Make the groupbox for the controls var fs1 = new qx.ui.groupbox.GroupBox("Login"); fs1.setLocation(4, 0); fs1.setRight(4); fs1.auto(); // Make the Username Label and TextFeild var usernameLabel = new qx.ui.basic.Label('Username:'); usernameLabel.setLocation(0,0); var username = new qx.ui.form.TextField(); username.setLocation(60,0); // Make the Password Label and TextFeild var passwordLabel = new qx.ui.basic.Label('Password:'); passwordLabel.setLocation(0,40); var password = new qx.ui.form.PasswordField(); password.setLocation(60,40); // Make the Login Button var btnLogin = new qx.ui.form.Button("Login", "icon/16/cdrom.png"); btnLogin.setLocation(60, 80); btnLogin.dataManager = 'loginDataManager'; btnLogin.name= 'loginButton'; btnLogin.addEventListener("execute", function(e) { checkLogin = new qx.io.remote.RemoteRequest('ajax/check_login.php'); checkLogin.method = 'get'; checkLogin.url = ''; checkLogin.asynchronous = true; checkLogin.addEventListener("completed", function(e) { // Some code alert('test'); }, this); checkLogin.send(); }); // Add the controls to the groupbox, then add the groupbox to the window fs1.add(usernameLabel, username, passwordLabel, password, btnLogin); w2.add(fs1); // Open the window w2.open(); }); **End Code**
The code works, and the completed function
fires, but I'm not sure of three things:
1. Am I calling the right class by
using qx.io.remote.RemoteRequest? I have tried XmlHttpTransport, but I get
a "not supported" error in the debug window.
2. How do I get the result of the remote call? Like
the "responseText" property of the Native XMLHttpRequest object?
3. How do I get the values of Username and Password
so I can append them to the url?
I have the latest SVN of qxBuilder, and a
login script in the tests directory. It seems to do exactly what I want but I
get 3 JS error messages running it locally (it only loads the grey
background):
1. QxObject is Undefined
2. QxTarget is Undefined
3. window.application is null or not an
object.
Ideas on either problem would do me. But learning
how the qooxdoo ajax layer works would be more benificial (rather than
qxBuilder).
Thanks
Aaron
|
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
