You need to sign in to do that
Don't have an account?
Making a mandatory field read only
Hi,
In my company there was a developer who made a mandatory field read only on a "Standard Page Layout" by writing a script from the 'custom component' section of 'Home Page Component' section and now the same task has been assigned to me and i am trying to replicate the same code by just changing the fieldID's and object ID's but i am not able to do: I have pasted the code which my developer had previously done:
In this code the developer has made a mandatory field read only on a custom object with standard page layout:
<div id="Pi"> <script> function mytest2()
{var strHref = window.parent.location.href; if(strHref.indexOf('/a3A')>0)
{ var b=document.getElementById('00N80000004eXaP') ; if(b !=null)
{ parent.document.getElementById('Name').disabled = true;}} }
var t=setTimeout("mytest2()",1000); </script> </div>
IN this code the developer has made case status drop down disabled:
<div id="Picklistvaluesid"> <script> function mytest()
{var strHref = window.parent.location.href; if(strHref.indexOf('/500')>0)
{ var b=document.getElementById('CF00N80000004rYE7') ; if(b !=null)
{ parent.document.getElementById('cas7').disabled = true;}}}
var t=setTimeout("mytest()",1000); </script> </div>
Now i have replicated the same code on another cutom object but it does not seem to work:
div id="Pi"> <script> function mytest2()
{var strHref = window.parent.location.href; if(strHref.indexOf('/a42')>0)
{ var b=document.getElementById('00NS00000001CiQ') ; if(b !=null)
{ parent.document.getElementById('00NS00000001Ci2').disabled = true;}} }
var t=setTimeout("mytest2()",1000); </script> </div>
Please help me.............................
In the ablove code i am trying to make a mandatory standard field read only on a standard page layout..i am not a pro in development but i am forced to do this so everones help is needed and appreciated,...
This code is not working fine......
Are you getting any errors on the page?
Not sure if it's just a copy/paste error, but you're missing an opening angle bracket:
<div id="Pi">
Sorry it was a typo error.. can anyone try this in ther instance and let me know the issue.. plzz.
It worked in my instance.
Add an alert('TEST'); to see if your script is being called on the page.