HTML5 Data Bindings Support Product Page
Answered
Conditional show
Asked 04 Mar 2014 16:28:14
1
has this question
04 Mar 2014 16:28:14 Andre Bender posted:
I want to show the field "EMailadresse" if the value of the field "ShowEMailadresse" is = 1I tried the following, but that doesn't seem to work:
<div class="contentBoxTextRow " data-binding-show="{{ShowEMailadresse}}" >
<i class="icon-envelope"></i> <a href="mailto:{{EMailadresse}}">{{EMailadresse}}</a>
</div>
Is this conditional case possible at all?
Replies
Replied 05 Mar 2014 10:59:26
05 Mar 2014 10:59:26 Teodor Kuduschiev replied:
Hello Andre,
This is a boolean check, depending on the data type. What data type is your {{ShowEMailadresse}} ?
This is a boolean check, depending on the data type. What data type is your {{ShowEMailadresse}} ?
Replied 05 Mar 2014 12:09:38
05 Mar 2014 12:09:38 Andre Bender replied:
1/0 tinyint
Replied 13 Mar 2014 15:09:36
13 Mar 2014 15:09:36 Andre Bender replied:
Any ideas?
Replied 13 Mar 2014 15:17:08
13 Mar 2014 15:17:08 Teodor Kuduschiev replied:
0 evaluates as false and 1 as true, so this works when it is indeed a number, if it is a string "1" or "0" then both will always be true.
With strings only an empty string will evaluate to false, any other string is true. When it is a string you should use {{ShowEMailadresse == '1'}}
With strings only an empty string will evaluate to false, any other string is true. When it is a string you should use {{ShowEMailadresse == '1'}}
Replied 13 Mar 2014 15:20:21
13 Mar 2014 15:20:21 Andre Bender replied:
Thanks Teodor. I'll give it a try.