HTML5 Data Bindings Support Product Page
Answered
Cant find Null/Blank Cell values
Asked 04 May 2014 00:20:40
1
has this question
04 May 2014 00:20:40 Genya Kaplun posted:
I have used HTML 5 Data Bindings to connect to a Google spreadsheet. It works great, I can get all the cell values without any problems. Here is my issue: one of the columns contains either blank cells or cells with an http address. The values are to populate afields on my page. I want to be able to format the links in <a href=VAR>Click Here</a> format. Again it works no problem as long as the cell contains an actual link. I wrote a simple if/else statement to check if the VAR (from the jquery via this extension) contains something, and here is where the problem is, no matter what I do, it always comes back as containing "something". I compared to Null to ==0 ||=="", i tried to use idexOf function, it always comes back as NOT null or empty or whatever. I am at a loss. I did document.write(VAR.length) and even if its blank it always comes back as 38 characters. So my question is when i am pulling data from google spreadsheet via this extension, how do blank cell come across? Am I missing something here?Here is what I am trying to accomplish, its such a simple thing i just dont get why its not working:
<script> function linkreg() { var NLtext=""; if ("{{feed.feed.entry[0].gsx$reglink.$t}}"==="0") { RLtext=""; } else { RLtext="Click to Find Out More"; } document.write(RLtext); } </script> <body> <div data-binding-id="repeat3" data-binding-repeat="feed.feed.entry">{{gsx$reg.$t}}[br]<a href="{{feed.feed.entry[0].gsx$links.$t}}"> <script type="text/javascript">linkreg();</script></a> … </body>
Replies
Replied 06 May 2014 11:24:12
06 May 2014 11:24:12 Teodor Kuduschiev replied:
Hello,
You can use the data.show / data.hide attributes in order to do this.
1. Select your <a tag make sure it is selected in the Properties inspector
2. Select the data element you want to check (in the data bindings tree)
3. From the Bind To dropdown select: a.data.show and click bind.
This way, when there is no value returned the <a tag will be hidden and when there is data returned it will be shown.
You can use the data.show / data.hide attributes in order to do this.
1. Select your <a tag make sure it is selected in the Properties inspector
2. Select the data element you want to check (in the data bindings tree)
3. From the Bind To dropdown select: a.data.show and click bind.
This way, when there is no value returned the <a tag will be hidden and when there is data returned it will be shown.
Replied 06 May 2014 23:57:06
06 May 2014 23:57:06 Genya Kaplun replied:
Hi, Thanks for your reply,
I dont have and a bind to option in my dropdown list ...
I dont have and a bind to option in my dropdown list ...
Replied 07 May 2014 00:39:31
07 May 2014 00:39:31 Genya Kaplun replied:
Nevermind, got it sorted. It worked great. Thanks for your help.