How to Disable a Button Under Specific Conditions
Disabling the Button When a Checkbox is Not Checked
- Place a [Checkbox] and a [Button].
- Enter
{{ !checkbox1.value }}
in the [Disabled] for the [Button].
Disabling the Button When No Value is Entered in an Input
- Place an [Input] and a [Button].
- Enter
{{ input1.value === '' }}
in the [Disabled] for the [Button].
Disabling the Button When Input Validation Fails
- Place an [Input] and a [Button].
- Add any validation to the [Input] under [Validation].
- Enter
{{ input1.invalid }}
in the [Disabled] for the [Button].
Setting Conditions to Disable the Button Using Logical Operators
- Place two [Input] s and one [Button].
- Set validations for [input1] and [input2] respectively.
- Enter
{{ input1.invalid || input2.invalid }}
in the [Disabled] for the [Button].
Setting Conditions to Hide the Button for Certain Users
- Click [Create] in the [Dataflows] and change the data flow name to
isButtonDisabled
. - Select
JavaScript
in [Select resource]. - Enter the following script in [Script]:
Assuming the scenario where the button is disabled when users
example01@querier.io
andexample02@querier.io
are logged in.
const disabledEmails = [
"example01@querier.io",
"example02@querier.io"
]
return disabledEmails.includes({{ querierCurrentUser.email }})
- Open the [Inspect] for the [Button] and enter
{{ isButtonDisabled.data ? "You do not have permission to execute" : "Execute" }}
in [Label]. - Enter
{{ isButtonDisabled.data }}
in [Disabled].