PDA

View Full Version : Passing parameters to dataset


pico303
11-15-2004, 09:40 AM
I feel as if I'm just missing something to make Laszlo click. I'm trying to pass parameters that came in from a web form into a Laszlo dataset, like so:

<canvas width="800" height="400">
<dataset name="listings" autorequest="false"
src="http://localhost/search.xml"/>
<!-- <dataset name="listings" autorequest="true"-->
<!-- src="http://localhost/search.xml?what=dogs"/>-->

<view name="myTable" width="800">
<simplelayout axis="y"/>

<view name="rowOfData" datapath="listings:/result/Description" oninit="search">
<text datapath="title/text()" width="800"/>

<method name="search">
Debug.write("Calling search");
var d = canvas.datasets.listings;
var p = new LzParam();
p.addValue("what", what, true);
d.setQueryString(p);
d.doRequest();
</method>
</view>
</view>
</canvas>

I'm basically trying to pass the parameter "what" coming in from the URL (http://localhost/search.lzx?what=dogs) into the dataset. Embedding the "search" method inside the view was my last attempt; I've also tried putting the code in a <script> tag, a global <method> and using oninit for the canvas, etc. How exactly do I pass a parameter along to the dataset tag?

P.S. The commented out <dataset> tag with the "what" value forced works just fine, so I know the referenced file works. The "search.xml" is really a servlet.