Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
How to extract the label from a select tag?
kwoo
For example, I have the following in a DCT:
<item name="Region" required="t">
<select>
<option value="1" label="US"/>
<option value="2" label="Canada"/>
<option value="3" label="North America"/>
</select>
</item>
I can retrieve the value from the option tag by doing the following in TPL:
<iw_iterate list="dcr.Region" var="region"><iw_value name='region'/></iw_iterate>
Can someone tell me if I can extract the label from the option tag as well? Thank you.
Find more posts tagged with
Comments
james1
That information is not available in the DCR. The only place that is guaranteed to have that information is the DCT. So, as a worst-case scenario, you could parse the DCT, looking for your item, and then looking for your option.
Is is possible to modify the value to contain all of the data that you need? That would be simpler.
-- James
akshathp
And, why you can not have an if condition in the TPL for the label portion? I mean, you could check the value and based on that apply the same label (hardocded) in your TPL if this is one odd case.
I know this could be a crude solution but for one odd case it would work fine I guess.
Hope this helps.
Akshat Pramod Sharma
Interwoven Inc.
Migrateduser
look at the dcr, if the label is not stored then you can not easily retrieve the label name from the dcr (as it is not there). the only thing that I can think of is to 1) change the value so that it matches the label in the dct 2) use the dct parsing library to parse the dct itself associated with the dcr and retrieve the information from there.