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)
Iteration
SexyBeast
I have a checkbox item in a DCT and I would like to iterate over the checked items in a TPL:.
<item name="State"">
<checkbox>
<option value="MA" label="Massachusetts"/>
<option value="RI" label="Rhode Island"/>
<option value="CT" label="Connecticut"/>
<option value="VT" label="Vermont"/>
</checkbox>
</item>
If I iterate using TPL tags I don't have a problem:
<iw_iterate list="iwpt_dcr_list('dcr.Region')" var="temp">
<h1><iw_value name="temp"/></h1>
</iw_iterate>
the selected option values are output as expected. If I try to instead output using perl I get empty <h1> elements:
<iw_iterate list="iwpt_dcr_list('dcr.Region')" var="temp">
<iw_perl><![CDATA[
my $state = iwpt_dcr_value($temp);
iwpt_output("<h1>$state</h1>");
]]></iw_perl>
</iw_iterate>
The loop is iterating correctly as I see <h1></h1> pairs for each selected item, but the value isn't output.
Any ideas?
Find more posts tagged with
Comments
mogoo
I pretty sure the way you refer to it the way you want to is
my $state = iwpt_dcr_value(temp.State);
...somebody please correct me if I'm wrong.
maureen
SexyBeast
I actually did try that and it had no effect (it still produced empty <h1> elements.)
Note: I had transcribed my code in the original post incorrectly, I posted:
iwpt_dcr_list('dcr.Region')
in the <iw_iterate> element, but the code actually has:
iwpt_dcr_list('dcr.State')
which matches the DCT. So that's not the root of the issue.
james1
I haven't tried this or tested it, but I *think* that instead of this:
my $state = iwpt_dcr_value($temp);
you want this:
my $state = iwpt_dcr_value("temp");
or maybe even this:
my $state = $temp;
?!?
Good luck
-- James
SexyBeast
my $state = iwpt_dcr_value("temp");
Did the trick. Thanks for your help.