Fuji client scripts: document object is null

aklimenko
Mega Expert

Hi

We use document.getElementById() or gel() in client scripts to get controls. In some places we cannot replace it with g_form. For example, I need to get a catalog item sys_id in variable set client script so the only way I could do that was document.getElementById("sysparm_id").value

What I found out is that for any client script document object is null:

[Error] TypeError: null is not an object (evaluating 'document.getElementById')

Any ideas?

42 REPLIES 42

if(access_description != '')   - why are you using this statement ? how are you checking your field value without using any getValue API?


function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }


if (!g_form.hasField('problem_id'))


  return;



if (!newValue)


  return;



g_form.getReference('problem_id', function(ref) {


  g_form.removeDecoration('problem_id', 'icon-info');


   


});


 


}



I am trying to hide this icon



let me know where i am doing it wrong?


Thanks in advance


Unfortunately, this System Property didn't do the trick for me (as I described in detail here: Re: Use getElementById in catalog client script )



Any other ideas?