On Sun, Jun 14, 2009 at 4:00 PM, aditya siram <[email protected]>wrote:

> Hi all,
> I'm having trouble generating debug code from the following Qooxdoo app:
> qx.Class.define("library.Application",
>   {
>    extend : qx.application.Standalone,
>
>    /*
>
> *****************************************************************************
>      MEMBERS
>
> *****************************************************************************
>   */
>
>    members :
>    {
>     /**
>      * This method contains the initial application code and gets called
>      * during startup of the application
>      */
>     main : function()
>     {
>      // Call super class
>      this.base(arguments);
>
>      < ...more GUI building code ...>
>
>     // Enable logging in debug variant
>      if (qx.core.Variant.isSet("qx.debug", "on"))
>      {
>        // 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.init();
>      }
>
>      var req = new qx.io2.HttpRequest("localhost:3000");
>      req.set({
>       url : '/library',
>       method : 'POST',
>       data : "isbn=" + isbn.getValue()  //isbn is a form field
>      });


>      button.addListener("execute", function(e) {
>       req.send();
>      });
>



Remember that you're in event-driven code. You just set the 'data' field of
your request to the *initial* value in the isbn form field. It will not be
reset to the value in the form field at the time that the button's "execute
" method is called unless you explicitly do so.

So, instead of the above, you probably want:

var req = new qx.io2.HttpRequest("localhost:3000");

button.addListener("execute", function(e) {
  req.set({
    url : "/library",
    method : "POST",
    data : "isbn=" + isbn.getValue()
  });
  req.send();
});


>      req.addListener("completed", function(e) {
>       resp = qx.util.Json.parseQx(e.getContent());
>       this.debug("hello world");
>       this.debug(resp.toString());
>      });
>

Without looking at how qx.io2 stuff works (io2 is still somewhat
experimental) or whether it actually generates a "completed" event, what you
have here seems reasonable. I expect though that you're using a "build"
version (generate.py build), and debug code is optimized out in the debug
version. Since you're using firefox, you can try console.debug instead of
this.debug.

Derrell
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to