Hi,
I want to make a button load a script from a server and process the returned data.
i cannot seem to make the c:load command work properly.
i tried the javascript version: bb.command.load, but i cannot find the order in which i need to put the arguments (Is there a backbase IDE?).
Could you help me out by giving me an example of both implementations?
Thanks,
Lesley

Sure, please take a look at
14 September, 2007 - 17:16 — marcelbeumerSure, please take a look at the code below.
inside your index.html:
<p>
<e:handler event="click">
<c:load url="foo.xml" method="GET" destination="." mode="replace"/>
</e:handler>
Load data with XEL
</p>
<p>
<e:handler event="click" type="application/javascript">
bb.command.load("foo.xml","GET",'','',this,'replace');
</e:handler>
Load data with JS
</p>
</div>
and the foo.xml could look like:
<div xmlns="http://www.w3.org/1999/xhtml">
<span style="border:1px solid red;">hi</span>
</div>
With regard to the API, please take a look at the CHM file. The CHM file contains a full list of which arguments to pass for each command.
Another example
16 September, 2007 - 21:05 — bufordThere's a little bit of rails in this example, but here is how I'm using c:load to update another element when a treeBranch element is clicked. HTH.
<e:handler type="text/xml" event="click">
<c:hide with="[id('contenttarget')]" />
<c:load url="/proggies/gridlist"
data="name=<%=h t %>"
mode="replaceChildren"
destination="id('contenttarget')"
type="text/xml" />
<c:show with="[id('contenttarget')]" />
</e:handler>
</b:treeBranch>
What would this look like
24 September, 2007 - 08:36 — burger.ljHi buford,
Thanks for your reply. I am still stuck though. What would this look like when the data is a variable with xml in it? Because i want to send the xml.
i got this:
is this correct?
Thanks in advance,
Lesley
I want to post the entire variable as a string
24 September, 2007 - 11:23 — burger.ljHi buford,
I want to post the entire variable as a string. adding string() does not seem to work on the entire variable. Is there a way to transform the xml to string?
Thanks in advance,
Lesley
bb.xml.serialize(element, childrenOnly)
25 September, 2007 - 08:48 — RichardTo convert XML into a string, you can use the function bb.xml.serialize
If you want to exclude the top element itself and just serialize the children of the root element of the variable, set the second parameter to true.
So if your variable is called $myVar:
bb.command.load(sUrl, 'POST', sData, null, oDest);
Almost there
25 September, 2007 - 10:24 — burger.ljHi Richard,
Thanks for your reply. I think this might be it.
The only problem now is that the load does not send the xml-string, but probably the object-data-string
I have this variable:
<e:data type="text/plain">
<a>
<b>
<c>c</c>
<d>d</d>
<e>e</e>
</b>
</a>
</e:data>
</e:variable>
and this should be sent:
<b>
<c>c</c>
<d>d</d>
<e>e</e>
</b>
</a>
Do you have an idea how to do this?
Thanks,
Lesley
CDATA is your friend
26 September, 2007 - 02:46 — RichardAlthough the type is "text/plain", what looks like XML inside the e:data element is resolved to plain text: '\nc\nd\ne\n' where the \n is a newline.
If you instead wrap the faux-XML in CDATA tags, there is no evaluation or modificaton. Its exactly what you want it to be.
<e:data type="text/plain"><![CDATA[
<a>
<b>
<c>c</c>
<d>d</d>
<e>e</e>
</b>
</a>
]]></e:data>
</e:variable>
Hi Richard, Thanks for your
26 September, 2007 - 12:24 — burger.ljHi Richard,
Thanks for your reply. Your solution works. Unfortunately for me the receiving end needs xml and not a string. I found this out because if it needed a string it would work. After installing a packet analyzer, i found out it needs real XML.
I am opening a new thread for this because this has nothing to do with c:load anymore.
Thanks again,
Lesley
bb.command.load works
27 September, 2007 - 10:15 — burger.ljHi Richard,
Thanks for your reply. I got it working now. I used to use c:load, but with bb.command.load it sends the xml as xml.
Lesley
Hy,I have an application
23 October, 2007 - 14:05 — tomluxHy,
I have an application which send the resulted HTML code back for showing up.
I'm replacing by a Javascript the div-content by the returned HTML code.
How can I make this?
I have tried with bb.command.load and bb.command.create.
No results.
Here an example:
var result = "<b:button>ClickMe<b:button>";
bb.command.create(bb.string.escapeXml(result),bb.getElementById('myDiv'),'firstChild'); </script>
Thanks,
Tom