function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kevin RichardsoKevin Richardso 

Dynamic Form Field - Newbie Question

I am wanting to put a checkbox that, when checked, displays further fields that are normally hidden. Any ideas?
jyotijyoti
If you want this to be dynamic, this solution will not work.  But if the checkbox is some criteria that will hold true for the record's life, maybe once this checkbox is TRUE, change the record type which is tied to a page layout where the other fields are exposed.
Kevin RichardsoKevin Richardso
Great idea...hadn't thought of that. I appreciate the response.
Benjamin_PirihBenjamin_Pirih
That's not completely true.. you can with javascript embedded in an scontrol do what your talking about..
Kevin RichardsoKevin Richardso
I thought about that...got any examples?
Benjamin_PirihBenjamin_Pirih

This hides a button if the conference is in a certain stage.. apply your own logic.. also notice the frametarget line.. the id will be unique to your scontrol..  you will need to create a scontrol with html which contains this code..

 

<html>

<head>

<script src="/soap/ajax/8.0/connection.js">

</script>

<script>

function initPage()

{

//alert('starting function');

// hack to fix sf.com short comings.. that id is the scontrol Id.. we are getting it.. to hide it..

var currentfr = parent.frames.document.getElementById('01N300000009eX5');

currentfr.style.height = '0px';

var currentStage = '{!Conference_Proposition__c.Review_Status__c}';

//alert(currentStage);

var controls = parent.frames.document.getElementsByTagName('INPUT');

//alert('Controls Selected: ' + controls.length);

for (var n=0; n<controls.length; n++)

{

if( controls[n].type == 'button')

{

// Not Submitted section

if ( currentStage == "Not Submitted")

{

//alert(controls[n].name);

if ( controls[n].name == 'conference_proposition_review' )

{

controls[n].disabled = 'true';

controls[n].style.visibility = 'hidden';

}

 

} // end of if type = button

} // end of for each control

 

} // end of function

</script>

</head>

<body onload="initPage();">

</body>

</html>

Benjamin_PirihBenjamin_Pirih

// hack to fix sf.com short comings.. that id is the scontrol Id.. we are getting it.. to hide it..

var currentfr = parent.frames.document.getElementById('01N300000009eX5');

currentfr.style.height = '0px';

 

if you don't do this you get the gray scontrol box.. not really a short coming..  just ugly :)