5

With a DWT, how to test if an embedded schema field has a value in a condition? The following code does not work and breaks on the TemplateBeginIf condition. Is this possible with a DWT?

<OffersText>
    <Title>Some title</Title>
    <Body>
        Body text
    </Body>
    <Select>Offer A</Select>
</OffersText>

<!-- TemplateBeginRepeat name="OffersText" --> 
  <!-- TemplateBeginIf cond="FieldPath + '.Select' = 'Offer A'" -->
    <div class="col-sm-3 LeftGutter LeftGutterT RightGutter RightGutterT">
      <p>SomeHTML Here...</p>
    </div>
  <!-- TemplateEndIf -->
<!-- TemplateEndRepeat --> 

1 Answer 1

7

The code inside the <!-- TemplateBeginRepeat --> has context... Just test your value as such. Also, you need an "is equal to" operator, rather than an "equals" I think ;)

The following works for me...

<!-- TemplateBeginRepeat name="OffersText" --> 
  <!-- TemplateBeginIf cond="Select == 'Offer A'" -->
    <div class="col-sm-3 LeftGutter LeftGutterT RightGutter RightGutterT">
      <p>SomeHTML Here...</p>
    </div>
  <!-- TemplateEndIf -->
<!-- TemplateEndRepeat --> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.