AnsweredAssumed Answered

Code is not working when trying to hide and show fields dependant on dropdown value.

Question asked by Hazel Hazel on Jan 22, 2015
Latest reply on Jan 22, 2015 by Muhammad Shaji Uddin
I am using SugarCRM CE 6.5.18.

I would like to hide and show 1 field when selecting dropdown value.
My to-be-hide and show field is... name="resolution", type="textarea.
My dropdown field is...                  name="type", type="dropdown", dropdownlist name is case_type_dom. I am using Cases module, btw. 

I place my code (.js file) at custom/modules/Cases/Cases.js
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');class casesChangeFields
var dropdown = document.getElementByName("case_type_dom");
function solution()
  var dropdown = document.getElementByName("case_type_dom");
  var selectedValue = dropdown.options[dropdown.selectedIndex].value;
  if (selectedValue == "General_Enquiry" || "Product_Enquiry" || "Points_Enquiry" || "Card_Replacement" || "Others")
   document.getElementByName("resolution").style.display = "none";
     document.getElementByName("resolution").style.display = "block";

I add these codes at the end of the 2 files into custom/modules/Cases/metadata/editviewdefs.php and custom/modules/Cases/metadata/detailviewdefs.php 
$viewdefs['Cases']['EditView']['templateMeta']['includes'] =  array (
  array (
   'file' => 'custom/modules/Cases/Cases.js',

However, no fields are being hide or display. Please help as I am really weak and using SugarCRM for the first time.