Hide Show Annotation

cspra
Giga Expert

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.

12 REPLIES 12

shloke04
Kilo Patron

Hi,



Your script looks good, only change you need to do is on the form layout in the Annotation script where you are defining the ID. It should be as mentioned below:



<div id="anno1" style = "line-height:2; font-size:13.4px;">Attachment Required</div>



You have written id twice in your script above in the form layout, it should be just the div tag having a ID defined for referencing while trying to hide or show the Annotation.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Thanks   Shloke.   Unfortunately, that didn't work either.   I also used span, div, divid - which I got from one of the forums.


Hi,



Can you post a screenshot of the annotation you configured in the form layout view?



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Here Shloke. Thanks.


Forum1.JPG