AnsweredAssumed Answered

Dependent dropdown does not work as expected, getting wrong parent dropdown value

Question asked by Marc Yu on Sep 12, 2014
Latest reply on Sep 14, 2014 by Marc Yu
Version: Sugar Pro 6.5.x

Could any one tell me what is the problem? is this a sugar bug or something?

i have add two dropdown field from the studio, on dependent on the other.

dropdown_1:
$GLOBALS['app_list_strings']['case_priority_dom']=array (
  '' => '',
  1 => '1',
  2 => '2',
  3 => '3',
  4 => '4',
  5 => '5',
  6 => '6',
);

dropdown_2:
$GLOBALS['app_list_strings']['problem_statement_list']=array (
  '' => '',
  'address_changes' => 'Address Changes',
  'annual_returns' => 'Annual Returns',
  'actuary' => 'Actuary',
  'admin_enquiry' => 'Admin Enquiry',
  '500_error_message' => '500 Error Message',
  'actuaries' => 'Actuaries',
  'ato_schedules' => 'ATO Schedules',
  'capital_gains' => 'Capital Gains',
);

Then i set dropdown_2 dependent on dropdown_1, and set the visibility as below:
$dictionary['Case']['fields']['problem_statement_c']['visibility_grid']=array (
  'trigger' => 'priority',
  'values' =>
  array (
    1 =>
    array (
      0 => 'actuaries',
    ),
    2 =>
    array (
      0 => 'ato_schedules',
      1 => 'capital_gains',
    ),
    3 =>
    array (
      0 => 'address_changes',
      1 => 'annual_returns',
      2 => 'actuary',
    ),

.............
ignore the rest.....
...........

All above job i did through studio, which i would guess nothing should went wrong...
However, after add them to the edit view (case module, it really should not matter), then i repair and rebuilt (not sure it is required), then i open the page.

the problem is:

when i select 1 in dropdown_1, i was expecting dropdown_2 set value as "actuaries", but the fact is it actually set two options:  "ato_schedules" and "capital_gains", which suppose only show when i select 2 in the dropdown_1.

and if i did select 2 in the parent, it set the options which should belongs 3....

No matter how i refresh, rebuilt, reopen..... could not resolve issue.

It is just a very straight forward and simple way to use the dependence in the field. i do not understand why it does not work.

could any one please help me out???

Thanks a lot.

Outcomes