# ドロップダウンの選択によって他のドロップダウンを非表示にしたい

**URL:** <https://community.cybozu.dev/t/topic/1290>\
**Category:** kintone 開発相談\
**Created:** [2023 年 1 月 10 日午前 3:29 UTC](https://community.cybozu.dev/t/topic/1290 "2023-01-10T03:29:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account113](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Legacy\_Account113](https://community.cybozu.dev/u/Legacy_Account113)\
**Post date:** [2023 年 1 月 10 日午前 3:29 UTC](https://community.cybozu.dev/t/topic/1290/1 "2023-01-10T03:29:02Z")

</div>

ドロップダウンの選択によって、グループフィールドの表示、非表示はできたのですが、

これを他のドロップダウンの表示、非表示に転用しようとしたところ叶いませんでした。

何かドロップダウン用の非表示のコードが別途あるものでしょうか。

教えて下さい。

社員区分（ドロップダウン）の選択によって、執行役員以上であれば執行役員用の計算グループが開き、同時に一般社員用の別のドロップダウンを非表示にしたいです。

執行役員以上であれば、執行役員用の計算グループが開くとことまでは動くのですが、

一般社員用の別のドロップダウンの非表示が叶いません。

&nbsp;

すみませんがお知恵をお貸しください。

&nbsp;const events = [‘app.record.detail.show’,  
&nbsp; &nbsp; ‘app.record.create.show’,  
&nbsp; &nbsp; ‘app.record.edit.show’,  
&nbsp; &nbsp; ‘app.record.create.change.社員区分’,  
&nbsp; &nbsp; ‘app.record.edit.change.社員区分’];  
&nbsp; kintone.events.on(events, (e) =\> {  
&nbsp; &nbsp; const record = e.record;  
&nbsp; &nbsp; const radioButtonValue2nd = record.社員区分.value;  
&nbsp; &nbsp;&nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; kintone.app.record.setFieldShown(‘執行役員フィールド’, false);  
&nbsp; &nbsp;&nbsp;  
&nbsp; &nbsp;switch (radioButtonValue2nd) {  
&nbsp; &nbsp; &nbsp; case ‘執行役員以上’:  
&nbsp; &nbsp; &nbsp; &nbsp; // 特定のグループを表示させる（この時点ではグループが閉まっている）  
&nbsp; &nbsp; &nbsp; &nbsp; kintone.app.record.setFieldShown(‘執行役員フィールド’, true);  
&nbsp; &nbsp; &nbsp; &nbsp; // 特定のグループを開く  
&nbsp; &nbsp; &nbsp; &nbsp; kintone.app.record.setGroupFieldOpen(‘執行役員フィールド’, true);  
&nbsp; &nbsp; &nbsp; &nbsp; break;  
&nbsp; &nbsp; &nbsp; case ‘執行役員以上’:  
&nbsp; &nbsp; kintone.app.record.setFieldShown(‘一般社員選択股’,false);

&nbsp; &nbsp; &nbsp; &nbsp; break;

---

<div class="post-metadata">

**Author:** ![Legacy\_Account1177](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@Legacy\_Account1177](https://community.cybozu.dev/u/Legacy_Account1177)\
**Post date:** [2023 年 1 月 10 日午前 3:36 UTC](https://community.cybozu.dev/t/topic/1290/2 "2023-01-10T03:36:50Z")

</div>

```
   switch (radioButtonValue2nd) {
      case '執行役員以上':
        // 特定のグループを表示させる（この時点ではグループが閉まっている）
        kintone.app.record.setFieldShown('執行役員フィールド', true);
        // 特定のグループを開く
        kintone.app.record.setGroupFieldOpen('執行役員フィールド', true);
// この行は不要です break;
// この行は不要です case '執行役員以上':
      kintone.app.record.setFieldShown('一般社員選択股',false);

        break;

```

&nbsp;

また「選択『肢』」「選択『股』」のフィールドコード指定が違うのかもしれませんね。

---

<div class="post-metadata">

**Author:** ![Legacy\_Account113](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Legacy\_Account113](https://community.cybozu.dev/u/Legacy_Account113)\
**Post date:** [2023 年 1 月 10 日午前 4:10 UTC](https://community.cybozu.dev/t/topic/1290/3 "2023-01-10T04:10:01Z")

</div>

[mls-hashimoto](https://community.cybozu.dev/hc/ja/profiles/385013133091-mls-hashimoto)&nbsp;様

早速のご回答誠にありがとうございます。

同じ条件を複数提示していたのでダメだったのですね。

動くようになりました！！！

また漢字の誤りもありがとうございました。

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/cybozu/original/1X/d5c841c3c5a6cb66eed514001c1b45147c9e1f4f.png) [@system](https://community.cybozu.dev/u/system)\
**Post date:** [2023 年 12 月 7 日午前 4:56 UTC](https://community.cybozu.dev/t/topic/1290/4 "2023-12-07T04:56:52Z")

</div>

クローズされました: 2023 年 12 月 7 日午前 4:56 UTC

このトピックはベストアンサーに選ばれた返信から 3 日が経過したので自動的にクローズされました。新たに返信することはできません。
