Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Pulldown Fields - Value vs. Label

 

 


InHouse
User

Aug 20, 2008, 1:46 PM

Post #1 of 3 (372 views)
Shortcut
Pulldown Fields - Value vs. Label Can't Post

I have a question about how CMSB stores info collected through a pulldown field.

Right now my menu field is populated from another table. It uses the record number for the value and a text field (title) as the displayed label.

When I look a the CMSB list of records, it appears to be storing the label string in the database rather than the expected record number. Have not yet checked the actual MySQL info.

When I display this info on a page, the expected shows up - the value (record number) and not the string. Good so far... but I actually would like to show the label text in this one instance rather than the record number. Since CMSB appears to be storing that anyway, is there a way that I can resolve to the stored label rather than create a secondary lookup for each displayed record?

If not, can you suggest an efficient lookup loop to handle this?

Many thanks,
J.


(This post was edited by InHouse on Aug 21, 2008, 12:35 PM)


Dave
Staff / Moderator


Aug 20, 2008, 6:23 PM

Post #2 of 3 (361 views)
Shortcut
Re: [InHouse] Pulldown Fields - Value vs. Lable [In reply to] Can't Post

Hi J,

There's no elegant built in way to do this yet. I think in future we may add pseudo fields that let you refer to either value as: fieldname:label or fieldname:value.

It is stored in the database as a value, and a label is shown in many cases on the backend as that's usually when people want (except when they don't!). :)

Anyways, here's some code to get the label from the value.

<?php
$tableName = 'news';
$fieldName = 'related';
$fieldValue = $newsRecord['related'];
$labelArray = getListLabels($tableName, $fieldName, "\t$fieldValue\t");
$label = @$labelArray[0];
?>

Just replace the variable name with your own and then use $label where you want the label to appear.

Let me know if this works for you.

Dave Edis - Senior Developer
interactivetools.com


InHouse
User

Aug 21, 2008, 10:28 AM

Post #3 of 3 (354 views)
Shortcut
Re: [Dave] Pulldown Fields - Value vs. Lable [In reply to] Can't Post

Thanks Dave! At least I'm not missing something obvious here (for a change).

I'll take your suggestions on board and see what I can make work.

Thanks for your input as ever.

Cheers,
J.

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4