Good Evening Everyone, I am a beginner with Qooxdoo and I am trying to learn it by converting some of my HTML, JavaScript and CGI work to qx. These are not production applications/pages/forms, nobody uses them, their only purpose is to improve and amuse me. While turning one of my old example HTML FORMs into a QX solution I got to a point where the Qooxdoo Documentation (the pdf that comes with QooxDoo) is not enough to explain or help what I am attempting to do. I hope the community can help me through this point with an example or with a pointer to an explanation.
Here is the sample HTML form: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <br /> <form action="http://keve.maclab.org/qx/webformprocess.cgi" method="POST"> Your name:<input name="Name_field" size="20" value="John" /><br /> <br /> <input type="submit" value="Send data!" /> </form> <br /> </body> </html> Here is the processing CGI script: #!/usr/pkg/bin/perl use strict; use POSIX qw(strftime); use CGI ':standard'; use CGI::Carp qw(fatalsToBrowser); my $formdata_nameField = param('Name_field'); unless (defined $formdata_nameField) { $formdata_nameField = 'WAS UNDEFINED'; } print "Content-type: text/html\n\n"; print "<pre>\n"; print "<p> Form data (Name) = $formdata_nameField .</p>\n"; print "</pre>\n"; And here is the qooxdoo script I put together: /* #asset(urlap_qx/*) */ /** * This is the main application class of your custom application "urlap_qx" */ qx.Class.define("urlap_qx.Application", { extend : qx.application.Standalone, /* ***************************************************************************** MEMBERS ***************************************************************************** */ members : { /** * This method contains the initial application code and gets called * during startup of the application * * @lint ignoreDeprecated(alert) */ main : function() { // Call super class this.base(arguments); // Enable logging in debug variant if (qx.core.Environment.get("qx.debug")) { // support native logging capabilities, e.g. Firebug for Firefox qx.log.appender.Native; // support additional cross-browser console. Press F7 to toggle visibility qx.log.appender.Console; } /* ------------------------------------------------------------------------- Below is your actual application code... ------------------------------------------------------------------------- */ // Create a form named "my_form". var my_form = new qx.ui.form.Form(); //Basic input field without headline. var Name_field = new qx.ui.form.TextField(); my_form.add(Name_field, "Your name"); var sendButt = new qx.ui.form.Button("Submit"); sendButt.addListener("execute", function() { if (my_form.validate()) { //alert("Attempting to POST the Form ..."); var my_controller = new qx.data.controller.Form(null, my_form); var my_model = my_controller.createModel(); var my_parameters = qx.util.Serializer.toUriParameter(my_model); var my_request = new qx.io.request.Xhr("http://keve.maclab.org/qx/webformprocess.cgi"); my_request.setMethod("POST"); my_request.setRequestData(my_parameters); // listener to give feedback my_request.addListener("success", function() { alert("Worked."); }, this); my_request.send(); alert("FormSend complete."); } }, this); my_form.addButton(sendButt); this.getRoot().add(new qx.ui.form.renderer.Single(my_form), {left: 10, top: 10}); } // end_main() } // end_members: }); // end_qx_class_define Live versions can be tested as follows: http://keve.maclab.org/qx/webform.html The HTML form. http://keve.maclab.org/qx/webformprocess.cgi The CGI script. http://keve.maclab.org/qx/index.html The qooxdoo "generate.py build" result. When I use and submit the old HTML form, the output of the CGI script loads into my browser window, displaying the value I entered on the form. When I use and submit the qooxdoo form, the "FormSend complete" message shows up, then the "Worked" message shows up, and that is it. Nothing more. The contents of the qx form remain in the browser window, the CGI script does not appear to be loaded and its output does not replace the browser window contents. Any suggestion on how to get the CGI script called properly is very much appreciated! Best Regards, Keve Nagy * Debrecen * Hungary ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
