What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

HTML Active Directory

FIS

New member
Onderstaand een stukje HTML script:



<div style="font-size:10pt; font-family: 'Arial';">
<strong>%%firstname%% %%lastname%% | %%title%% | %%department%%</strong><br/>
%%street%%<br/>
%%zipcode%%, %%city%%<br/>
%%mobilenumber%%<br/>
%%email%%<br/>
%%customattribute1%%</div>

Now the question is if a field of the active directory is empty e.g. %%title%% how do we get it done that the <|> is not displayed.
 
To prevent displaying the <|> separator if a field in the HTML Active Directory is empty, you can use conditional statements or template engines in your code. Here's an example using JavaScript and the ternary operator:

<div style="font-size:10pt; font-family: 'Arial';"> <strong>%%firstname%% %%lastname%% | %%title%% | %%department%%</strong><br/> %%street%%<br/> %%zipcode%%, %%city%%<br/> %%mobilenumber%%<br/> %%email%%<br/> <% if (%%customattribute1%%) { %> %%customattribute1%% <% } %> </div>
 
Back
Top