How to hide the annotations on the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 12:05 PM
Hi,
I have created the annotations on my form and under that I have some field.I have hidden that field using UI policy but the annotation is still visible.
Please let me know when we can hide the annotation.
Thanks
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 01:43 PM
This seems to work:
First, give your annotations a div id as outlined in the comments by janani in this post:
In my instance I made a blue info box annotation with the following entry
<div id="anno1">Test annotation</div>
Next, write a client script to fiddle with it. I wrote mine as an onLoad script but I did a quick test using onChange and it seemed to work there too.
function onLoad() {
//Type appropriate comment here, and begin script below
document.getElementById("anno1").parentNode.style.display="none";
}
Hope that works for you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2014 08:32 AM
@acretion This is working a little too well for me;
It will indeed hide the annotation but I can't make it reappear based on a second script
I have your script above as well as
function onChange(sysIDs, table, oldValues, newValue, callback) {
var sc = g_form.getValue('subcategory');
if (sc == "App2") {
anno1.style.display = "block"; }
else anno1.style.display = "none";
}
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2014 11:25 AM
Try this one. (You can change it back to storing the subcategory in a different variable if you want, I normally just use newValue). Edit - I just realized you might have this client script running onChange to a different variable than subcategory, so I got rid of the newValue bit.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var sc = g_form.getValue('subcategory');
if (sc == "App2") {
document.getElementById("anno1").parentNode.style.display="block";
}
else {
document.getElementById("anno1").parentNode.style.display="none";
}
}
Then you could also change the onload script to leave the annotation visible if the subcategory is already set to App2 when the page loads.
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('subcategory') != "App2"){
document.getElementById("anno1").parentNode.style.display="none";
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2014 02:04 PM
I am looking to do something similar...
I have an On Change Client Script, I would like to show an annotation label only show when a particular value is selected
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'Yes')
{
document.getElementById("ano1").parentNode.style.display="block";
}
else
{
document.getElementById("ano1").parentNode.style.display="none";
}
}
The choice value defaults to none, when I load the page, the label is still present. I only want the label to be present when "Yes" is selected as a choice.
Not sure what is missing to achieve this. Any ideas?