When working with dynamic fields in form.yml I noticed that if a hidden element has
required: true the form will not be submittable unless the hidden element has a default value.
Here is an example:
sub_type: label: Submission Environment widget: select help : Select desired submission environment. cacheable: false options: - [ "Basic Modules", "mod_basic", data-hide-load-commands: true, data-hide-sif-file: true ] - [ "Advanced Modules", "mod_adv", data-hide-sif-file: true ] - [ "Container", "sif", data-hide-load-commands: true ] load_commands: label: Setup Commands (bash syntax) help: | Enter additional additional environment setup commands. These commands are run before starting MATLAB. - Load, or manipulate module environment using `module` - Extensions will only find programs provided by the module system if you load the required modules here! - Run arbitrary commands or source a bash script. cacheable: false widget: text_area placeholder: | module load <software-name> source "$HOME/project_a/setup-env.sh" sif_file: label: Container File help: | Select an Apptainer/Singularity Container (.sif/.simg) that includes [code-server](https://github.com/coder/code-server) 4.6.0 or newer. cacheable: false data-filepicker: true data-target-file-type: files data-target-file-pattern: '(.simg|.sif)$' readonly: true required: true
In this case the default for the form is to not use a container, but when the user elects to use a container we want to ensure that the a sif file is selected before the form can be submitted.