Gosse Westra
Posts: 0
Joined: Tue Jun 16, 2015 8:05 pm

how to hide empty labels

Hello,

I try to do something with the contacts tutorial. now is my question. I can access all my contacts and receive the complete contacts list from my phone. i show the contacts with a name, phonenumber and email adress. But some contacts dont have a email address or phonenumber or no name. How do i remove this labels from the list when the list ist loaded? here is a screenshot Image

thanks a lot

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

how to hide empty labels

Hello Gosse,

Unfortunately custom app logic is outside the scope of our support, but we can suggest you the main idea:
1) make the label invisible
2) read its value with js
3) if the value isn't equal to null make this label visible.

Gosse Westra
Posts: 0
Joined: Tue Jun 16, 2015 8:05 pm

how to hide empty labels

Hello Evgene,

Thanks for your reply.
I am new to programming but i found out this.
i used this javascript

Apperyio("contactName").hide();

if (contactName.val === "") {

}
for the contactName label that works but if i use it for the phoneNumber label and email label i still get a response Null how is this working? i noticed tha if i don't use this code for the conactName label i get an empty field

For the phoneNumber label i used this code

Apperyio("phoneNumber").hide();

if (phoneNumber.val === "null") {

}

and for the email label this code

Apperyio("email").hide();

if (email.val === "null") {

}

probably it's a logical explanation but i don't know where to search :(

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

how to hide empty labels

Hello Gosse,

Please add to the mapping field which could be empty this JS:

preif (!value){
element.parents("tr").hide();
}/pre

Return to “Issues”