Hide Annotation with Client Script

Not applicable

Is it possible to hide an Annotation with a client script the way we can make fields visible/invisible?

I'd like to be able to hide an Annotation along with a set of fields for a specific set of users.

As a workaround, I suppose I could create an actual field with a colored label, but that seems like brute force.

15 REPLIES 15

Not applicable

Its possible to hide a custom annotation with client script
When you create custom annotation , you can use HTML tags.
Try using the Div tag in the Annotation Text
div id="div1" (enclose this within "<" and ">")

----annotation text here----

( end "div" tag)

Now it can be hidden using the following in the client script,
if (condition)
{
div1.style.display = 'none';
}


I just used this and it works great!


A small addition to this technique. We were finding it a little disconcerting that the annotation was appearing as the form was being built on the screen, then disappearing if the conditions for displaying it weren't met. So, we decided to do things the other way around. We defined the annotation such that by default it would not be displayed, then in the client script, if the conditions matched, we set the attribute to display it.

The Annotation was something like:



<div id="majinc" style="display:none">
Major Incident
</div>


The client script included:



var mi = g_form.getValue('u_major_incident');
if (mi == "true") {
majinc.style.display = "block";
}



Brian Broadhurst (TeamUltra Ltd.)


Is this client script "On Load" or "On Change"?