Display dropdown value?

nemesyssoft 13 Apr, 2015
Hello.

I created a CF form and one of the field is a dropdown. When the user chooses an item from the dropdown, its index is saved in the database.

Now, I'm using a CC connection to display those rows from the database. How can I substitute the index value for the string that the user picked in the CF form? I tried to add a "computed" field based on the example in the FAQ of direct edit where a column from the database is displayed in a custom field but that didn't work. No error just nothing displayed under the column in the CC connection.

Anybody has any idea?

Thanks in advance.
GreyHead 17 Apr, 2015
Hi nemesyssoft,

Off the top of my head this might work.

In the listing header declare a global array of the values:
<?php
global $items;
$items - array (
  1 => 'some value',
  2 => 'some other value',
  . . . 
);
?>

The in the row box (or the PHP box you should be able to use something like this
<?php
global $items; 
echo $items[$row->id];
?>

Bob
mgergel 11 May, 2015
1 Likes
This was useful when I was looking for doing this is CC but I was using a custom list display not a table.
Here is what I used for my custom.
<?php
global $items;
$items - array (
  1 => 'some value',
  2 => 'some other value',
  . . . 
);
?>

This is just like the Bob's suggestion.
<?php
global $items;
echo $items[$row['Model Title']['id']];
?>


Unlike Bob's suggestion I had to change my "$row" statement. Bob or Max may want to comment why.
But after I did this everything worked.

Mark
Tinkerer
This topic is locked and no more replies can be posted.