Hide Show Annotation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2017 03:57 PM
Hello,
I was trying to HIDE / SHOW an Annotation, if particular business condition is met.
Unfortunately, after trying this via CLIENT SCRIPT and UI POLICY and by also following steps from different forums, it still didn't work.
Here's my Annotation HTML script (FORM Layout / Form Design) Excerpt ONLY:
<divid id="anno1" style = "line-height:2; font-size:13.4px;">Attachment Required</divid>
In CLIENT SCRIPT and UI POLICY Excerpt ONLY:
var statusx = g_form.getValue('status');
if (statusx == 'Draft'){
document.getElementById("anno1").parentNode.style.display="block";
}
else {
document.getElementById("anno1").parentNode.style.display="none";
}
}
The Browser DEV Tool is giving me this error -
Uncaught TypeError: Cannot read property 'getElementById' of null
Am I missing something here?
Appreciate your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 04:29 PM
Strange
Same logic is working fine for me. have tested this in Istanbul version. Please find the screenshots below:
Client Script:
Result:
Will suggest you make sure your field name is correct and the value which you are checking for the state field is correct or not. In your second line double check the backend value of status field whether it is "Draft" or a numeric value.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 05:23 PM
Thanks for the effort Shloke. Yes this is totally strange. Our approach work as well on my personal instance.
We just discovered solution by directly using the ID itself to manipulate the display.
Here -
anno1.parentNode.style.display="none";
I also hope that others who are facing the same issue can find this alternate approach useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 09:21 AM
Thank you for sharing this. The same thing happened with me.
This piece of code was working everywhere in the system, except for one particular annotation for no reason
document.getElementById("anno_id").parentNode.style.display="block"
I was struggling for one week until I find yours solution
annotation_id.parentNode.style.display="block";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 01:36 AM
Hey there,
Could you please try using gel instead of document.getElementById.
Also would request you to check the value of status you are getting if its numeric or string.
Let me know if this was helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 05:38 AM
Thanks for the suggestion Divya. However, I am more inclined to use document.getElementById as I find it a straightforward solution. I am not sure if I am missing something in my above approach.