Cheers mate.
  ----- Original Message ----- 
  From: Jim Hunter 
  To: qooxdoo Development 
  Sent: Friday, November 17, 2006 10:52 AM
  Subject: Re: [qooxdoo-devel] Resetting all fields


  You would think that would be the syntax, but it's not. Inside the braces, 
the 'this' keyword actually refers to the child object, not the parent. So you 
can do something like this:

  object.forEachChild(function()
  {
    try
      this.setValue('');
    catch(e)
      {;}
  }

  Again, this would only clear the immediate children, not the children of a 
child. But since you know which objects contain the edits then you should have 
no trouble clearing them with the above syntax. 

  Jim



  On 11/16/06, Aaron Cooper <[EMAIL PROTECTED]> wrote:
    Thanks Jim, I really appreciate the help you've been giving me this last 
few days!

    I actually found forEachChild in the API earlier and gave it a go, but 
after your post I see where I went wrong. All the fields are on 3 splitpanes 
(labels on the left, fields on the right), and each split pane is on it's own 
TabViewPage.

    So I will have to do this locally rather than a general function me thinks.

    Just to clarify the use of forEachChild. Does this look right?

    object.forEachChild(function(e) {
        e.setValue('');                     
    });

    Cheers
    Aaron
      ----- Original Message ----- 
      From: Jim Hunter 
      To: qooxdoo Development 
      Sent: Friday, November 17, 2006 10:03 AM
      Subject: Re: [qooxdoo-devel] Resetting all fields


      A brute force way would be to iterate each child control of the window 
(assuming that you are placing your edit controls on the window itself and not 
on some other control in the window) using forEachChild and then issue a 
setValue('') on each child (wrap this in a try/catch because not all qooxdoo 
controls have a setValue() method. 

      This is a brute force way but it will work. If you don't like the 
ugliness of the try/catch, you can add a method to the qx Object as an empty 
method (that way all controls can call the method but only ones that you create 
code for will actually do something). Then in your edit control, override the 
method with code to clear the value. Then you can also write a method of Object 
that iterates all children and all their children and calls this new method for 
clearing the value. Then you can make one call to the window to clearValues and 
everything gets cleared. 

      I give you this cryptic answer to get you started, you always learn more 
from working out the code yourself. If you are having trouble with the concepts 
or with implementing it, let me know and I'll give you some actual code (I do 
this sort of thing in my app, the code not the withholding of information :-) 
). 

      Jim



      On 11/16/06, Aaron Cooper <[EMAIL PROTECTED]> wrote: 
        Is there an official way to reset all fields on a qooxdoo 'form'?

        I have a window for data entry, when the user clicks the 'Save' or 
'Home' button, the data entry window closes, and the Home window opens again.

        If you navigate back to the data entry window, any data typed before is 
still there.

        Obviously the windows for this app are loaded from the start, and are 
only closed when not needed. Rather than being totally destroyed and reloaded 
each time.

        Would using window.dispose() be a better option to get what I'm after?
        And what does window.restore() do exactly? 

        I ask as I've tried the above method (dispose/restore) unsuccessfully.

        If manually coding each feild and setting the value to blank when the 
window closes is the only way then I'll do that, but I was hoping for something 
more like document.getElementsByTagName or the like as there are over 30 
fields, it'd be nice just to have a loop.

        Cheers
        Aaron

        
-------------------------------------------------------------------------
        Take Surveys. Earn Cash. Influence the Future of IT
        Join SourceForge.net's Techsay panel and you'll get the chance to share 
your
        opinions on IT & business topics through brief surveys - and earn cash 
        
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 

        _______________________________________________
        qooxdoo-devel mailing list
        [email protected] 
        https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel







--------------------------------------------------------------------------


      -------------------------------------------------------------------------
      Take Surveys. Earn Cash. Influence the Future of IT
      Join SourceForge.net's Techsay panel and you'll get the chance to share 
your
      opinions on IT & business topics through brief surveys - and earn cash
      http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 


--------------------------------------------------------------------------


      _______________________________________________
      qooxdoo-devel mailing list
      [email protected]
      https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel




    -------------------------------------------------------------------------
    Take Surveys. Earn Cash. Influence the Future of IT
    Join SourceForge.net's Techsay panel and you'll get the chance to share your
    opinions on IT & business topics through brief surveys - and earn cash 
    http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 

    _______________________________________________
    qooxdoo-devel mailing list
    [email protected] 
    https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel







------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to share your
  opinions on IT & business topics through brief surveys - and earn cash
  http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


------------------------------------------------------------------------------


  _______________________________________________
  qooxdoo-devel mailing list
  [email protected]
  https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to