View Full Version : usage of combobox
mohan
09-03-2003, 06:24 AM
Hai antun ,
Can i use the combobox in my real application?
In my application i am going to select content from the combobox (like books,magazines etc).once i select the particular content(like books) from the combobox,
i have to set the datapath to the dataset which contain the path information about the content in the
combobox.then i have to get the data from the dataset which contains the path information about the items image (actually images are stored in the some directory in the lps server).
Thanks
Mallesh
antun
09-03-2003, 09:45 AM
Yes the combobox has been fully functional since the 1.0.1 release, which was a couple of weeks ago. However it doesn't allow you to have a separate "background" data reference for each item. In other words, what's displayed is the data you get.
What you described sounds like you want to display things like "Books,Magazines,etc." in the combobox, and when the user selects "Books" to have the combobox set the querystring to something like:
myserversidescript.php?action=getDetails&what=books
In the above case, the CGI GET variable is lowercase "books", but what's displayed in the combobox is "Books" with a capital B. That's what I mean by the data you see is the data you get. You could lowercase the value as shown in the example below:
<canvas debug="true">
<dataset name="namelist" >
<items>
<item>Books</item>
<item>Magazines</item>
<item>Trinkets</item>
<item>Posters</item>
<item>CDs</item>
</items>
</dataset>
<simplelayout />
<combobox x="10" y="50" width="152" shownitems="4"
itemfield="nameList:/items/item/text()"
datapath="nameList:/items/item[1]/text()"
name="mycombo" >
<method name="getSelectedText">
return this.top.subviews[3].getText();
</method>
</combobox>
<button>
<method event="onclick">
var s = mycombo.getSelectedText();
debug.write( "BEFORE: " + s );
debug.write( "AFTER: " + s.toLowerCase() );
</method>
</button>
</canvas>
This also means that if someone types in a value instead of selecting that, that's what you're going to get what the user typed. You could create your own "pulldown" box, using the code for combobox (it's in WEB-INF\lps\components\redmond), and replacing <inputtext> with <text>, so that the user can't edit the contents of the selected item.
Those are the only issues I can imagine you having with combobox as it stands now.
How many items are there likely to be in your combobox?
Is it an important part of the app?
-Antun
mohan
09-16-2003, 07:15 AM
Hi Antun,
Regarding my previous question on combobox,actually in my application i am quering the database according to the data in the combobox.(like if i select books from the combobox then i used this information to send the query to the data base).So how can i achieve this.
And also i coud'nt understand your words,
"However it doesn't allow you to have a separate "background" data reference for each item. In other words, what's displayed is the data you get."
We can use the String comb=getParameter("name of the combobox") in JSP or in SERVLET to get value of the combobox and using this,we can query the database accordningly. So how can i do this in lzx.
Thanks
mallesh
antun
09-16-2003, 09:15 AM
And also i coud'nt understand your words,
"However it doesn't allow you to have a separate "background" data reference for each item. In other words, what's displayed is the data you get."
In an HTML pull-down menu, you can give each item in the pull-down menu both some descriptive text, and a value, which gets passed to whatever back-end script you're using when the form is submitted, as a CGI variable. The user never sees the "value" parameter. You can't have a "value" parameter in the Laszlo combobox.
We can use the String comb=getParameter("name of the combobox") in JSP or in SERVLET to get value of the combobox and using this,we can query the database accordningly. So how can i do this in lzx.
I'm not much of a JSP person, but all you need to do is to pass the combobox value via JSP via CGI GET variables over HTTP. You would set the variables using either the setQueryString() (http://www.laszlosystems.com/developers/learn/documentation/lzxref/dataset.php#meth-setQueryString) or the setQueryParams() (http://www.laszlosystems.com/developers/learn/documentation/lzxref/dataset.php#meth-setQueryParams) methods of a <dataset>. Then you'd call doRequest() to send the request. Whatever XML your server responded with will be in that dataset.
-Antun
rcheramy
11-10-2004, 12:52 PM
Originally posted by antun
<canvas debug="true">
<dataset name="namelist" >
<items>
<item>Books</item>
<item>Magazines</item>
<item>Trinkets</item>
<item>Posters</item>
<item>CDs</item>
</items>
</dataset>
<simplelayout />
<combobox x="10" y="50" width="152" shownitems="4"
itemfield="nameList:/items/item/text()"
datapath="nameList:/items/item[1]/text()"
name="mycombo" >
<method name="getSelectedText">
return this.top.subviews[3].getText();
</method>
</combobox>
<button>
<method event="onclick">
var s = mycombo.getSelectedText();
debug.write( "BEFORE: " + s );
debug.write( "AFTER: " + s.toLowerCase() );
</method>
</button>
</canvas>
-Antun [/B]
I have to believe the aforementioned code has been changed since this was posted as it compiles with errors.
Perhaps this post should be deleted or edited?
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.