CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 How to retrieve list box option's text value?

Print topic Send  topic

Author Message
Punya

Posts: 2
Posted: 09/09/2005, 9:34 AM

Hi,

Here is an exmple of a list box:

<select name="s1">
<option value="4">four</option>
</select>

I can retireve the option's value as
e.getGrid().getControl("s1").getValue();

I looked at ListBox. It has something called getTextColumn() which returns Text column NAME. Anyone knows how to retrieve the text value displayed?

Thanks,
Punya
View profile  Send private message
matheus

Posts: 386
Posted: 09/09/2005, 12:19 PM

I didn't test, but I think is getBoundColumn() in ListBox object. (Maybe need cast object control to ListBox)
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
matheus

Posts: 386
Posted: 09/09/2005, 12:24 PM

getBoundColumn() get bd field name.

Must look in ListBox and List class any tip.
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
Punya

Posts: 2
Posted: 09/09/2005, 1:01 PM

getBoundCoulm() just returns the name of the bound column defined for the list box while creating the grid. But don't see any direct method that retrieves the selected option's text. Looks like there is a workaround by getting getOptions() method. Will try that if nothing works :-(

Thanks,
Punya
View profile  Send private message
matheus

Posts: 386
Posted: 09/09/2005, 1:49 PM

Enumeration enumeration =
((ListBox)e.getControl()).getFormattedOptions();

while ( enumeration.hasMoreElements() ) {
String[] option = (String[]) enumeration.nextElement();
if (option[List.SELECTED] != null) {
System.out.println(option[List.TEXT_COLUMN]);
}
}

Something like this. ;-)
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
sheetal
Posted: 11/30/2005, 4:23 AM

Quote :
The same can be done in the jsp page where the form action is by:

String s1 = request.getParameter("listbox_name");
sheetal
Posted: 11/30/2005, 4:24 AM

Quote :
The same can be done in the jsp page where the form action is by:

String s1 = request.getParameter("listbox_name");
sheetal
Posted: 11/30/2005, 4:26 AM

Quote :
The same can be done in the jsp page where the form action is by:

String s1 = request.getParameter("listbox_name");
matheus

Posts: 386
Posted: 11/30/2005, 8:02 AM

It's wrong.

Parameter was value not text.
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.