HTML5 Data Bindings Support Product Page

Answered

How can I hide a data field if it has no value?

Asked 31 Jan 2014 15:57:50
1
has this question
31 Jan 2014 15:57:50 Steve Skinner posted:
I am outputting some data from a customer database, and some fields are optional, and do not always have a value. When there is no value in one of these fields, I just want to hide the line and the <br /> tag that resides on the same line as the field.

I just want to avoid having blank white spaces when there are no values in these optional fields. In old asp, I would simply use an ASP If / Then statement, but I'm not quite sure how this works with the new data bindings. I looked in the Formatter and didn't see anything for this.

Replies

Replied 31 Jan 2014 16:04:49
31 Jan 2014 16:04:49 Teodor Kuduschiev replied:
Hello Steve,
You can wrap the line with a <span> for example:
<span>{{option_name}} [br]</span>

Then select the span in the properties inspector, click on the @option_name in the data bindings panel, under your dataset, select Bind to: span.data.show and Bind
The result should be like:
<span data-binding-show="{{option_name}}">{{option_name}}<br></span>

Replied 31 Jan 2014 19:00:44
31 Jan 2014 19:00:44 Steve Skinner replied:
Awesome. That works perfect. Thanks for your help as always!
Replied 26 Nov 2014 22:54:41
26 Nov 2014 22:54:41 Matt Penn replied:
worked like a charm

Reply to this topic