CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 [Solved] Listbox: always select first record

Print topic Send  topic

Author Message
Markie


Posts: 251
Posted: 12/05/2008, 8:56 AM

At one of my pages I have a listbox.
Now, this listbox says "Select Value".
I would like to have the listbox automatically select the first record in the row. Is this possible ?

I understand it is possible to go for the Default Value, but in my case the records in the listbox are user specific (different contents of the listbox for different users) and I don't see how to use a Default Value in this situation.
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
DonP
Posted: 12/05/2008, 9:08 AM

Simply open the HTML and remove the Select Value option to leave only
the dynamic options. Then it will list the first one based on the list
box's SQL.

Don (DonP)

Markie wrote:
> At one of my pages I have a listbox.
> Now, this listbox says "Select Value".
> I would like to have the listbox automatically select the first record in the
> row.
> Is this possible ?
> _________________
> The Netherlands, GMT+1
> Tools: CCS 4.1.00.027, Win XP, Navicat, PSPad
> Local server: XAMPP with Apache, php and MySQL
> Webserver: Ubuntu with Apache, php and MySQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
Markie


Posts: 251
Posted: 12/05/2008, 10:24 AM

Great ! that was simple ...

Thanks
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
DonP
Posted: 12/07/2008, 12:22 AM

I'm glad to help!

Note that a bug in all versions of CCS so far (I haven't tried v4.x yet)
make the Select Value option be marked as "selected" even when another
value is marked selected because it somehow hard-codes the "selected"
into it. In IE and several other browsers, this is not a problem because
they look for "selected" from the bottom up. However, Netscape and
Mozilla-based browsers look for it from the top down and always stop
when they find one that is marked as "selected" even when there is
another farther down in the list. If you don't notice it and you save
the data, anything that was previously selected for the field is wiped out!

Don (DonP)

Markie wrote:
> At one of my pages I have a listbox.
> Now, this listbox says "Select Value".
> I would like to have the listbox automatically select the first record in the
> row.
> Is this possible ?
> _________________
> The Netherlands, GMT+1
> Tools: CCS 4.1.00.027, Win XP, Navicat, PSPad
> Local server: XAMPP with Apache, php and MySQL
> Webserver: Ubuntu with Apache, php and MySQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
Markie


Posts: 251
Posted: 12/07/2008, 12:57 AM

Thanks DonP,

While working on this topic, I have another question. Is it possible to select the URL parameter in the Listbox ? For example, my URL is

listboxpage.php?option=test

and the selected option in the listbox will be "test"

My URL is

listboxpage.php?option=anothertest

and the selected option in the listbox will be "anothertest"

is this possible ? if so, how to do this ?
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
Gena

Posts: 591
Posted: 12/07/2008, 2:35 AM

Quote Markie:
While working on this topic, I have another question. Is it possible to select the URL parameter in the Listbox ? For example, my URL is

listboxpage.php?option=test

and the selected option in the listbox will be "test"

My URL is

listboxpage.php?option=anothertest

and the selected option in the listbox will be "anothertest"

is this possible ? if so, how to do this ?

yes, you can do it. Use BeforeShow for that listbox. Put code like

  
$option=CCGetParam("option","");  
$Component->SetValue($option);  

_________________
Gena
View profile  Send private message
Markie


Posts: 251
Posted: 12/07/2008, 2:52 AM

wow, this is cool !
thanks Gena
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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