Dynamic behaviour with check box

Hi,

Still learning and building on knowledge of ondemand. Such a useful portal for HPC

We are setting up ondemand 2.0.23 and have tried the dynamic behaviour of hiding fields in the form using the select widget (copying from the ansys template) which works great.

Is it possible to show and hide fields using a checkbox widget being checked and unchecked, and if so how should this be constructed in the form.yml.erb?

Thanks

Hi Kickers. Welcome to the OnDemand Discourse thread.

You ask a great question. Out of the box, we do have what we call “Dynamic JavaScript (DynJS)”. However, it does not currently do what you are asking. The DynJS functionality works in conjunction with the drop-down elements. We do not have anything out of the box for the checkboxes. I would say you should be able to add your own JS functionality in form.yml.erb to control the hide/show functionality.
You should be able to use something like the following at the top of the file.

<script type='text/javascript'>
 .... 
  Your JS code
 ....
</script>

Looking forward to seeing how this goes.

Thanks,
-gerald

Thanks Gerald,

I shall have a play with setting something up using the JS, so I don’t need anything else (or to enable anything else) but to include the JS script at the top of the form.yml.erb?

That should do it. I’ll add a feature request for this functionality. It will be down the road before we can get to it, but it seems that it may be something that we can make function like the Dynamic JS.