Re: Another tricky data transfer question.
Alex Russell <[email protected]>
| Newsgroups | gmane.comp.windows.devel.netwindows |
|---|---|
| Organization | netWindows.org |
| Message-ID | <[email protected]> |
On Tuesday 09 September 2003 02:12, Christian Boulanger wrote: > If I want to submit a form and get data back in return, how would you do > that one? > > With __env__.submitForm you can load html content in an already existing > contentNode, but what I want to do is to be able to have the response > parsed into an array. > > I guess some combination of data.getData and __env_submit would do the > trick, but how? NW_addFormValues() to the rescue = ) See the docs for this method in environ_core.js for details. Here's the submit button of our form (whitespace added for clarity only) : <input type="submit" onclick="__data__.getData( 'http://foo.com/bar.php?'+NW_addFormValues(this.form), someObj, "listenerFunc", ["foo"], ["foo"], "deep" );" /> The crux of this is to use NW_addFormValues() with a reference to a node in the form to construct the GET query string representing the form's current values. You will need to specify the target href yourself somehow, but that's not a problem (I assume?). Also, I can't imagine many situations in which you'll use a syntax like the above instead of a wrapper function of some kind, but there you have it. Hope that helps. -- Alex Russell [email protected] BD10 7AFC 87F6 63F9 1691 83FA 9884 3A15 AFC9 61B7 [email protected] F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46 _______________________________________________ The netWindows developers list: [email protected] http://netwindows.org/mailman/listinfo/devel_netwindows.org