# Have options only show up when button is not clicked

**URL:** <https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372>\
**Category:** Get Help\
**Created:** [July 21, 2025, 5:23pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372 "2025-07-21T17:23:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kstine](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/kstine/32/2539_2.png) [@kstine](https://discourse.openondemand.org/u/kstine)\
**Post date:** [July 21, 2025, 5:23pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372/1 "2025-07-21T17:23:13Z")

</div>

Is it possible to have OOD only show and use `form.yml` options if a checkbox is unclicked?

I’d like to make it so that if a user checks a “use entire node” button, it’ll send `--exclusive` to the `submit.yml` (and the `script.sh.erb`). But if it’s unchecked, it would show memory, cpus, and gpus to be requested (and send those values to the `script.sh.erb`).

Is this possible? Or would I need to set up two apps, one for `--exclusive` and one without?

---

<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:** [July 21, 2025, 5:58pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372/2 "2025-07-21T17:58:24Z")

</div>

Yes you can use dynamic javascript. I believe we added checkbox support for this in 4.0.

> **[Dynamic Form Widgets — Open OnDemand 4.0.0 documentation](https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/dynamic-form-widgets.html#hiding-entire-elements)**

Though note that if you hide stuff, you should also set it back to some well defined value. That is, **even if it’s hidden from the user, it’ll still be submitted to the server with whatever value it has**.

So you have to be careful here in the `submit.yml.erb` to make some additional interpretations.

---

<div class="post-metadata">

**Author:** ![kstine](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/kstine/32/2539_2.png) [@kstine](https://discourse.openondemand.org/u/kstine)\
**Post date:** [July 21, 2025, 6:14pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372/3 "2025-07-21T18:14:12Z")

</div>

Thanks for the response. I’ve tried that, but it doesn’t seem to be working.

I have the following set in my `form.yml`:

```auto
  m_exclusive:
    widget: "check_box"
    label: "Use entire node"
    html_options:
      data:
        hide-m-cpus-when-checked: true
        hide-m-mem-when-checked: true
  m_cpus: 
    widget: "number_field"
    label: "Number of CPU cores to allocate to worker instance"
    required: true
  m_mem:
    widget: "number_field"
    label: "Amount of memory in GB to allocate to worker instance"
    required: true
    min: 8
    max: 1952
    step: 8
    help: |
      Amount MUST be divisible by 8. Otherwise the job will fail. Max is 1952.

```

However, it doesn’t actually hide `m_cpus` and `m_mem`

---

<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:** [July 21, 2025, 6:21pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372/4 "2025-07-21T18:21:24Z")

</div>

Works for me, though you need to enable this feature - it’s disabled by default.

> **[ondemand.d/\*.yml files — Open OnDemand 4.0.0 documentation](https://osc.github.io/ood-documentation/latest/reference/files/ondemand-d-ymls.html#bc-dynamic-js)**

---

<div class="post-metadata">

**Author:** ![kstine](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/kstine/32/2539_2.png) [@kstine](https://discourse.openondemand.org/u/kstine)\
**Post date:** [July 21, 2025, 6:27pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372/5 "2025-07-21T18:27:14Z")

</div>

Ah, that was it. Thanks! It seems to be working now 🙂

---

<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:** [January 17, 2026, 6:27pm UTC](https://discourse.openondemand.org/t/have-options-only-show-up-when-button-is-not-clicked/4372/6 "2026-01-17T18:27:33Z")

</div>

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