# Hiding a form field with dynamic form widgets

**URL:** <https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473>\
**Category:** Get Help\
**Tags:** ondemand2, question\
**Created:** [February 10, 2023, 8:54pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473 "2023-02-10T20:54:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [February 10, 2023, 8:54pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473/1 "2023-02-10T20:54:51Z")

</div>

I am noticing an incorrect hiding behavior when using the “bc\_email\_on\_started” pre-defined form widget. We want to hide it for some “clusters” (in reality the Linux Host Adapters), and show for others (the SLURM clusters through which the e-mails about jobs works).

I do modify the bc\_email\_on\_started by adding a “help” section, and the help section does not hide. I tried to modify the bc\_email\_on\_started definition in the form.yml to add the type of the widget (check\_box), and a few other things, but, the help always shows. For another default widget for which I use “help”, bc\_num\_hours, the help hides correctly.

So, I am wondering if there’s something special about bc\_email\_on\_started that makes the help not hide.

In form.yml, I have something like this (in a condensed form showing only the relevant pieces):

```auto
  cluster:
    widget: select
    options:
      - kingspeak
      - [
          'frisco1',
          data-hide-bc-email-on-started: true,
          data-hide-bc-num-hours: true
        ]
  bc_num_hours:
    value: 1
    min: 1
    step: 1
    help: "Maximum wall time on notchpeak-shared-short is 8 hours, general nodes 72 hours, owner nodes 14 days."
  bc_email_on_started:
    help: "If you do not receive the email, check your [Profile](https://www.chpc.utah.edu/role/user/edit_profile.php) for correct address."

form:
  - cluster
  - bc_num_hours
  - bc_email_on_started

```

When I choose kingspeak, the bc\_email\_on\_started shows correctly as

```auto
[] I would like to receive an email when the session starts
If you do not receive the email, check your Profile for correct address.

```

But, when I choose frisco1, instead of removing the whole widget, it only removes the checkbox and leaves the help:

```auto
If you do not receive the email, check your Profile for correct address.

```

Any thoughts on this?

Thanks,  
Martin

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 10, 2023, 9:40pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473/2 "2023-02-10T21:40:01Z")

</div>

Yea that seems to be a bug because the help text is a sibling of the checkbox and not a child.

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [February 10, 2023, 9:53pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473/3 "2023-02-10T21:53:44Z")

</div>

Thanks Jeff. Anything I can do to fix it, or you’ll have to do it in OOD?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [February 10, 2023, 9:59pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473/4 "2023-02-10T21:59:37Z")

</div>

No, it’s a bug on our side. I opened this ticket for the same.

> <https://github.com/OSC/ondemand/issues/2562>
>
> From discourse - https://discourse.openondemand.org/t/hiding-a-form-field-with-d…ynamic-form-widgets/2473 - hiding check boxes doesn't hide help labels.
> 
> You can tell from inspecting the html that the help text is a sibling of the hidden check box, not a child.
> !\[image\](https://user-images.githubusercontent.com/4874123/218204348-5920fdbd-60a7-4096-a147-d9b56df0028c.png)
> 
> here's a form.yml to replicate.
> 
> \<details\>
> 
> \`\`\`yaml
> attributes:
> cluster:
> widget: select
> options:
> - kingspeak
> - \[
> 'frisco1',
> data-hide-bc-email-on-started: true,
> data-hide-bc-num-hours: true
> \]
> bc\_num\_hours:
> value: 1
> min: 1
> step: 1
> help: "Maximum wall time on notchpeak-shared-short is 8 hours, general nodes 72 hours, owner nodes 14 days."
> bc\_email\_on\_started:
> help: "If you do not receive the email, check your \[Profile\](https://www.chpc.utah.edu/role/user/edit\_profile.php) for correct address."
> 
> form:
> - cluster
> - bc\_num\_hours
> - bc\_email\_on\_started
> \`\`\`
> 
> \</details\>
> 
> ┆Issue is synchronized with this \[Asana task\](https://app.asana.com/0/1201735133575781/1203949894687169) by \[Unito\](https://www.unito.io)

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [February 10, 2023, 10:42pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473/5 "2023-02-10T22:42:39Z")

</div>

Great, thanks, that’ll be a good incentive for us to do an update once you fix this.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [August 9, 2023, 10:43pm UTC](https://discourse.openondemand.org/t/hiding-a-form-field-with-dynamic-form-widgets/2473/6 "2023-08-09T22:43:21Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
