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?
Yes you can use dynamic javascript. I believe we added checkbox support for this in 4.0.
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.
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:
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