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
08-05-2014 09:55 PM
Rachelle,
An onChange script won't run when the initial form load happens, it will only be triggered when the field the onChange script is written on changes. I'd suggest writing an additional onLoad script to hide the annotation when the form loads unless your conditions are already met.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2014 09:40 AM
Thanks for the feedback!! I was trying to avoid having both an "On Change" & "On Load" Client Script, but looks like that's just what i'll need to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2017 11:35 AM
Hi have you thought about using UI policies and the "Run Scripts" option? You can then just use the relevant line of code
document.getElementById("anno1").parentNode.style.display="block";
or
document.getElementById("anno1").parentNode.style.display="none";
in the "Execute If true" and "Execute if false"
This worked a treat for me - runs on display and change, with simple condition buiilder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2017 12:25 AM
Hello Rachelle, If you want to run onChange script at the time of onLoad then you can do that by removing if (isLoading || newValue == '') { return; } this code and you can avoid two scripts. Thanks, Dhananjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 01:12 AM
Just went through the pain of getting this to work and our developer fixed the following.
Created a UI policy against the field you want to show the annotation against. In this case, a 'Yes/No' field, annotation only to show on YES and hide when none or NO.
UI Policy Script
execute if true
function onCondition() {
var refs3 = document.getElementsByClassName("annotation-wrapper");
refs3[24].style.display = 'block';
}
execute if false
function onCondition() {
var refs3 = document.getElementsByClassName("annotation-wrapper");
refs3[24].style.display = 'none';
}
This annotation is the 25th annotation, in 'form design' you count them 0-24.
The obvious problem to be aware of.
If annotations are added or removed above this annotation then the script will start hiding the new 25th annotation.
So we amended and added the label feature in the annotation to pick up specific annotation, no need to number them.
In the annotation you need to a a lablel.
<div id="annotation_label"> Annotation Text Goes Here </div>
UI Policy Script
execute if true
function onCondition() {
var refs3 = document.getElementById("annotation_label");
refs3.style.display = 'block';
refs3.parentElement.style.display = 'block';
}
execute if false
function onCondition() {
var refs3 = document.getElementById("annotation_label");
refs3.style.display = 'none';
refs3.parentElement.style.display = 'none';
}