Dynamic generation of Select Widget options based on answer to an earlier form field

In my form.yml.erb I’m executing a shell command to dynamically generate the list of SLURM partitions a user has access to in our cluster and dynamically populating the select widget options for the ‘custom_queue’ form field.

Now based on the slurm partition choosen from the drop down menu I want execute another shell command to generate a list of the SLURM account names and populate the select widget options for the next form field where I’m allowing the user to select the SLURM account.

Would it be possible to dynamically generate the select widget options by running a command on the node using the answer provided on an earlier form field ?

Are these any examples of such forms developed any where ?

Thanks,
Krishna.

Hi sorry for the delay.

You could generate a list based off of a command. But it’s a once only operation when the form loads. So it’s only the initial list that generates, not really the dynamic behaviour you’re looking for.

You might be able to pull this off with Java script. I do it to show/hide text fields. You could probably make an empty select widget and then populate it with JS?