Open Bug 832725 Opened 11 years ago Updated 10 years ago

custom field that "only appears when" certain op_sys values are selected isn't re-hidden when different platform is selected

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

4.2.4
defect
Not set
minor

Tracking

()

People

(Reporter: eb3f73+buzilla+com, Unassigned)

Details

To reproduce:

1. Go to Admin -> Field Values -> OS/Version.

2. Add the value "foo" that "Only appears when Platform is set to:" [value A].

3. Add the value "bar" that "Only appears when Platform is set to:" [value B].

4. Create a custom field (free text is fine) where that "field only appears when" op_sys "is set to any of": "foo", "bar".

5. Go to enter_bug.cgi.

6. From the platform drop-down, select [value A] (from step 1).

7. From the op_sys drop-down, select "foo".

8. Note the custom field appears.

9. From the platform drop-down, select a platform that is not [value A] or [value B] (from step 1).

10. Note that some other value is now selected in the op_sys drop-down (since the previous value is now unavailable).

11. Note that the custom field still appears, where it should have been re-hidden.

12. From the op_sys drop-down, select something other than "foo" or "bar" (which shouldn't appear anyway).

13. Note that the field now disappears (even though it should have already disappeared after step 10).
FYI, I tried to emulate this bug using ONLY custom fields, but they appear to behave correctly. Here's what I did:

1. Created cf_test1 (enter_bug => 1) as drop-down. Added values:
- 'foo'
- 'bar'

2. Created cf_test2 (enter_bug => 1) as drop-down with "Field that controls the values that appear in this field" set to cf_test1. Added values:
- 'baz' (Only appears when cf_test1 is set to: 'foo'
- 'quux' (Only appears when cf_test1 is set to: 'bar')

3. Created cf_test3 (enter_bug => 1) as free text with "Field only appears when:" cf_test2 "is set to any of:" 'quux'.

4. Went to enter_bug.cgi.

5. From the cf_test1 drop-down, selected 'bar'.

6. From the cf_test2 drop-down, selected 'quux'.

7. cf_test3 appeared.

8. From the cf_test1 drop-down, selected 'foo'.

9. The cf_test2 drop-down reverted to '---' (since 'quux' was unavailable).

10. cf_test3 was re-hidden.

So the custom field mechanics appear to get this right. For some reason having a similar setup with rep_platform/op_sys is flawed.
There's something going on in the Javascript magic that is apparently beyond my ken. I will note that the calls of the above two examples appear similar:

This doesn't hide cf_op_sys_custom during the appropriate times:

>        <script type="text/javascript">
>        <!--
>          initHidingOptionsForIE('op_sys');
>          showFieldWhen('cf_op_sys_custom',
>                'op_sys', ['foo','bar']);
>        //-->
>        </script>

This does hide cf_test3 during the appropriate times:

>        <script type="text/javascript">
>        <!--
>          initHidingOptionsForIE('cf_test2');
>          showFieldWhen('cf_test3',
>                'cf_test2', ['quux']);
>        //-->
>        </script>

I've also tested this with multiple values showing cf_test3, a la:

>        <script type="text/javascript">
>        <!--
>          initHidingOptionsForIE('cf_test2');
>          showFieldWhen('cf_test3',
>                'cf_test2', ['corge', 'quux']);
>        //-->
>        </script>

That works. It appears that keying off of the built-in op_sys field to show/hide a custom field is the use case that fails.
Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.