# Dynamic form widget

**URL:** <https://discourse.openondemand.org/t/dynamic-form-widget/2301>\
**Category:** Get Help\
**Created:** [September 29, 2022, 5:13pm UTC](https://discourse.openondemand.org/t/dynamic-form-widget/2301 "2022-09-29T17:13:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmdickens](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/cmdickens/32/1285_2.png) [@cmdickens](https://discourse.openondemand.org/u/cmdickens)\
**Post date:** [September 29, 2022, 5:13pm UTC](https://discourse.openondemand.org/t/dynamic-form-widget/2301/1 "2022-09-29T17:13:18Z")

</div>

For the following on version 2.0.28, the data-hide-node-type and data-max-bc-num-slots works great but the data-max-memory-per-node does not work. The max memory per node should change to 3000 when mem\_node\_type is ‘big’ and 360 when mem\_node\_type is standard but the max remains 3000 despite selecting ‘standard’

```auto
---
title: "VNC bigmem"
cluster: "grace"
form:
  - mem_node_type
  - mem_per_node
  - node_type
  - bc_num_slots
  - bc_vnc_resolution
attributes:
  bc_vnc_resolution:
    required: true
  mem_node_type:
    widget: select
    label: "Memory Node type"
    options:
      - [
           "Standard memory (max 360GB)", 'standard',
           data-max-mem-per-node: 360,
           data-max-bc-num-slots: 48,
        ]
      - [
           "Big memory (max 3TB)", 'big',
           data-max-mem-per-node: 3000,
           data-max-bc-num-slots: 80,
           data-hide-node-type: true,
        ]
  mem_per_node:
    label: "Total Memory per node (GB)"
    widget: "number_field"
    value: 7
    min: 7
    max: 3000
    step: 1
    help: |
        - Standard mem node (7 - 360GB)
        - Big mem node (37 - 3000GB)
  node_type:
    widget: select
    label: "Node type"
    options:
      - ["RTX"]
      - ["T4"]
      - ["A100"]
      - ["ANY"]
  bc_num_slots:
    label: "Number of cores:"
    value: 1
    min: 1
    max: 80
    step: 1

```

---

<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:** [September 29, 2022, 5:17pm UTC](https://discourse.openondemand.org/t/dynamic-form-widget/2301/2 "2022-09-29T17:17:02Z")

</div>

Hi and welcome! I hate to do this to you on your first topic with us, but that’s a bug on our side.

> <https://github.com/OSC/ondemand/issues/2115>
>
> If I had something like this, where I wanted to toggle the max \`memory\` and \`nod…es\` (to other fields from this one), it doesn't currently work, only changing \`memory\`. Which is to say, we can't change 2 things at once, at least for the min & max handlers.
> 
> \`\`\`
> options:
> - \[
> "Compute", "compute"
> \]
> - \[
> "Debug", "debug",
> data-max-memory: 200,
> data-max-nodes: 3,
> \]
> \`\`\`
> 
> 
> 
> ┆Issue is synchronized with this \[Asana task\](https://app.asana.com/0/1202821104799596/1202823840221155) by \[Unito\](https://www.unito.io)

---

<div class="post-metadata">

**Author:** ![cmdickens](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/cmdickens/32/1285_2.png) [@cmdickens](https://discourse.openondemand.org/u/cmdickens)\
**Post date:** [September 29, 2022, 6:43pm UTC](https://discourse.openondemand.org/t/dynamic-form-widget/2301/3 "2022-09-29T18:43:05Z")

</div>

Thanks, we are able to get around this bug by adding a mem field for each node type and use data-hide which does allow multiple data-hide directives

```auto
  standard_mem:
    label: "Total GB memory (max 360)"
    widget: 'number_field'
    value: 1
    min: 1
    max: 360
    step: 1
  big_mem:
    label: "Total GB memory (max 3000)"
    widget: 'number_field'
    value: 7
    min: 7
    max: 3000
    step: 1
  mem_node_type:
    widget: 'select'
    label: "Memory Node type"
    options:
      - [
           "Standard memory (max 360GB)", 'standard',
           data-max-bc-num-slots: 48,
           data-hide-big-mem: true,
        ]
      - [
           "Big memory (max 3TB)", 'big',
           data-max-bc-num-slots: 80,
           data-hide-node-type: true,
           data-hide-standard-mem: true,
        ]

```

---

<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:** [March 28, 2023, 6:43pm UTC](https://discourse.openondemand.org/t/dynamic-form-widget/2301/4 "2023-03-28T18:43:30Z")

</div>

Closed on March 28, 2023, 6:43pm UTC

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