Thursday, May 22, 2008

Various Ways To Hide/Unhide A Field/Section In CRM

by Danny Varghese 03.28.08

Intro

When customizing forms in CRM, one of the most commonly used and simplest things to do is a hide a field on the form.  This may be hiding one or numerous fields on the form.  Often times, developers may need to use several “hidden” fields for other purposes.  In this case, he/she could place all those fields in a section on the form, and then hide the section.

Hiding A Field

To hide a field use the following code snippet:

 crmForm.all.<insert schema name of field>_c.style.visibility = ‘hidden’;crmForm.all.<insert schema name of field>_d.style.visibility = ‘hidden’; 

 


OR

crmForm.all.<insert schema name of field>_c.style.display = ‘none’;crmForm.all.<insert schema name of field>_d.style.display = ‘none’; 

You will have to hide both the “_c” and “_d” parts of the field.  The “_c” appended to the field is the label of the field, and “_d” is the data contained in the field.

Un-hiding A Field 

To un-hide a field, use the following code snippet:

crmForm.all.<insert schema name of field>_c.style.visibility = ‘visible’;

crmForm.all.<insert schema name of field>_d.style.visibility = ‘visible’;

 

OR


 

crmForm.all.<insert schema name of field>_c.style.display = ‘block’;crmForm.all.<insert schema name of field>_d.style.display = ‘block’; 

 


Hiding A Section


 


To hide a section (which will in turn, hide all fields in that section), use the code snippet below:

 crmForm.all.<insert schema name here>. parentElement.parentElement.parentElement.style.display = 'none'; Un-hiding A Section

To un-hide a section, use the code snippet below:


crmForm.all.<insert schema name here>. parentElement.parentElement.parentElement.style.display = 'block';



No comments: