Developer forum

Forum » Development » If Statement with contains not behaving as expected?

If Statement with contains not behaving as expected?


Reply
Hi there,

I am using the new If Statements in a template. I am trying to read the value from a custom order line field implemented as a checkbox. To work around an issue where an unchecked checkbox is not submitted and Dynamicweb doesn't update the order line field appropriately (I'll start a separate thread on that), I added a hidden field besides the checkbox. This in turn means that my field value could be either an empty string, 'on', or ''on,' where the comma comes from the empty hidden field.

To check for these values I used the contains If Statement. However, it turns out that if the value is *exactly* 'on', then contains doesn't return true. E.g.:

Value: <!--@Ecom:Order:OrderLine.OrderLineField.Value--><br />
<!--@If(Ecom:Order:OrderLine.OrderLineField.Value<startswith>'on')--> Starts
with <br /> <!--@EndIf-->
<!--@If(Ecom:Order:OrderLine.OrderLineField.Value<contains>'on')--> Contains
<br /> <!--@EndIf-->

This returns:

Value: on
Starts with

while I expected it to return:
 


Value: on
Starts with
Contains

Because 'on' *does* contain 'on', no?

Imar

Replies

 
Nicolai Høeg Pedersen
Reply
Its a bug...

Fixed already with TFS6318.

Due with SR 2 on monday.
 
Reply
Wow, that's quick! ;-)

Thanks,

Imar

 

You must be logged in to post in the forum