Hide/Display Annotations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2019 02:15 PM
I have a form with a few fields and annotations "1" and "2". 1 has to display if the logged in user has a particular role and 2 otherwise.
I've tried using document.getElementById(<id>).parentNode.style.display='block'; on an OnLoad Client Script, OnChange Client Script and UI Policy. I've tried to declare document.getElementById(<id>) to a variable and modify the styling separately. Doesn't work.
I'm on Kingston. If anyone has any experience making this work, please suggest a solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2019 02:22 PM
Use below code to hide annotations.
But, please be careful since every DOM manipulation is not supported.
try {
gel('p1andp2').parentNode.style.display = "block";
} catch (error) {
console.log('Error with Client Script "Hide Annotation": ' + error);
}
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2019 02:37 PM
Block will display it and none will hide it. Have you used both in the same script?
if user has role 1
document.getElementById(anno1).parentNode.style.display='none';
document.getElementById(anno2).parentNode.style.display='block;
else if user has role 2
document.getElementById(anno1).parentNode.style.display='block';
document.getElementById(anno2).parentNode.style.display='none';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 05:30 AM
Yup. I've used both in the same script and also tried putting both in different scripts. No success.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 06:36 AM
hi
Thanks,
Rahul Kumar