matt
|
| Posted: 09/02/2005, 3:30 PM |
|
I'm sure there is a simple answer to this, but I'll be damned if I can find it.
I want to retrieve the value of the bound column of a listbox for use in a comparison. For example :
if ($page->listbox->GetValue() == 1)
{ do something }
For whatever reason, I can not find the proper incantation that will get me the value in the listbox's bound column (or the text column, for that matter). I'm doing this in the listbox's "before build select" event as I want to dynamically modify the listbox depending on what is already there.
|
|
|
 |
DonB
|
| Posted: 09/02/2005, 5:35 PM |
|
The listbox has no value in the Before Build Select event because the
listbox is in the process of being constructed. Listbox SELECTs are
executed early in the Record control's initialization sequence, before the
POST parameters are evaluated.
I think you really want to know what the value it was last set to when the
user clicked "Submit". That page, with the Listbox that had a value, is
gone. You are dealing with a new instance of the page. You must get the
form control values from the POST data sent back to the server.
I would try using:
if (CCGetParam("myListbox","0") == "1") { # Assuming the Listbox is
named "myListbox"
do something
}
--
DonB
http://www.gotodon.com/ccbth
|
|
|
 |
matt
|
| Posted: 09/07/2005, 9:45 AM |
|
>> I think you really want to know what the value it was last set to when the
user clicked "Submit". That page, with the Listbox that had a value, is
gone. You are dealing with a new instance of the page. You must get the
form control values from the POST data sent back to the server.
Actually, I want to know what the value is being set to as it is retrieved from the database for that row in the DB. That is, it is being set to a value from the DB - I want to use that value to restrict what is available in the listbox for selction. For example, if value currently = 'A', then the valid values in the listbox can be B or C. If it equals B, then the valid value can only be D.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 09/07/2005, 1:25 PM |
|
I suspect that there aren't enough details here. The listbox can be handled differently depending on where it is placed. I recommend that you describe your page in more details, how the page will be used, or provide an example of any Web page on the Internet that functions similarly to what you want.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Michael Mikkelsen
|
| Posted: 09/08/2005, 3:13 PM |
|
You will need to get the current value useing the
CCDLookUp(field, table, where_clause, connection)
function If you want know the value in the "before build select" event because that is done before the database is queryed for the current value.
|
|
|
 |
|