Is the fields within a tab or just a selected few fields?
To achieve this you will need to include Javascript into the page to show or hide fields when there is a change on the dropdown.
What I did below is created a new field that is the dropdown called ‘type_of_customer_c’ and placed this on my EditView display via Studio.
I then created a new panel called ‘Mobile Form’ with all the fields that would be in this section of the record.
Once those fields are added, displayed, and deployed via Studio we then need to add the javascript and functionality to this particular module.
You will need to edit one file (custom/modules/<MODULE_NAME>/metadata/editviewdefs.php) and create a new js file (e.g. contact_edit_java.js) and place it where you wish to place it (I placed mine in custom/include/javascript/contact_edit_java.js)
In the editviewdefs.php find your dropdown that will initate the functionality (mine was type_of_customer_c). Add the additional parameters of ‘displayParams’ (if not already there).
9 =>
array (
0 =>
array (
'name' => 'type_of_customer_c',
'studio' => 'visible',
'label' => 'LBL_TYPE_OF_CUSTOMER',
'displayParams' =>
array(
'field' =>
array(
'onChange' => 'checkMobileForm()',
),
),
),
1 => '',
),
Now your index may be differen tthan mine (the number 9) so don’t edit anything else, just insert the following like above:
'displayParams' =>
array(
'field' =>
array(
'onChange' => 'checkMobileForm()',
),
),
Still in the editviewdefs you will need to call the newly created js file. Just before ‘useTabs’ (which is close to the top) insert the includes array if not already there.
'includes' =>
array (
0 =>
array (
'file' => 'custom/include/javascript/contact_edit_java.js',
),
),
After this we need to create a new js file within custom/include/javascript/ called contact_edit_java.js (or the name you choose).
Within this js file you will create the function to hide and display your mobile related panel.
function checkMobileForm(){
var value = document.getElementById("type_of_customer_c").value;
if(value == 'mobile'){
document.getElementById("detailpanel_2").style.display = 'block';
}
else{
document.getElementById("detailpanel_2").style.display = 'none';
}
}
checkMobileForm();
NOTE - you will need to find the id of your panel viewing the page’s source code as you may have more panels created than I have. So your id maybe 3, 4 or 5.
ONce that is done, Quick Repair and Rebuild will clear your cache and should bring in the new javascript and initate the function when you select and change the dropdown.
Hope this helps.