Disable Container JavaScript

Hi everyone,

I would like to use JavaScript resource to disable a container - the intention is to run this script on the Success of an execution query. I tried containerName.disabled = true but this is not working.

Any suggestion ?

Thank you,
Daniel

Hi Daniel! You wouldn’t be able to directly assign values to the objects inside of the data model like this since the JS is run in a sandbox. There are specific JS methods that can make specific changes, like textinput1.setValue(“hello”), but the container doesn’t support a method for directly changing the disabled setting.

Most settings don’t have a direct JS method, but for anything that accepts a custom input (rather than a dropdown or toggle) you can create a new temporary state, and then use tempState.setValue(true) in your JS query. Then in the container’s Disable this container setting you can reference {{tempState.value}}.

1 Like

Update! We now support dynamically disabling containers :tada:

In an event handler, you can choose to "Control component" and set disabled

Or in a JS query (or in an event handler when you choose "Run script"), you can call the .setDisabled(boolean) function!

Let us know if you have any questions at all :blush: