What is setData?
setData is an attribute of the Widget element.
Definition of setData
Its function is to collect all the widget labels that have been defined in it's
parameter list and submit them to a URI. This process only occurs on a loadUrl
or loadGui method invocation.
(Note: in the older versions of Bambookit GUI, prior to build 375, the commas had to be
URL encoded, when defining more than a single parameter, i.e. setData="widget1%2cwidget2%2cwidget3")
Let's create a more complete example to demonstrate it's basic usage
>From the example above note that the each Edit element is named, widget1, widget2 and widget3.
In the Button element, we call setData and we pass the 3 Edit widgets by name to this Button Widget.
The addActionTarget invokes the loadUrl method which would request the values from the widgets
defined in setData.
Location of setData
(Note that, when the TARGET of the addActionTarget changes, then the
setData MUST be moved to the new widget location.)
>From the example above you note that we have now named the parent widget 'main'.
We also moved the setData to this widget. Why? because in the button, addActionTarget,
the execute method is on the main widget.
loadUrl and loadGui
The only time setData is needed is when a loadUrl or a loadGui is invoked
What is the URI output?
>From the previous example we would get the following URI request
There is a difference between the two methods loadGui and loadUrl beyond simply loading an
XML file into the applet or loading a new URL into the web browser. The ability to POST
data! You can ONLY POST data via the loadGui attribute, the loadUrl can ONLY use the GET
protocol and is thus limited to the URL lenght that gets submitted (about 1Kb)