Documentation
Apps
Guides
How to Disable a Button Under Specific Conditions

How to Disable a Button Under Specific Conditions

Disabling the Button When a Checkbox is Not Checked

  1. Place a [Checkbox] and a [Button].
  2. Enter {{ !checkbox1.value }} in the [Disabled] for the [Button].

Disabling the Button When No Value is Entered in an Input

  1. Place an [Input] and a [Button].
  2. Enter {{ input1.value === '' }} in the [Disabled] for the [Button].

Disabling the Button When Input Validation Fails

  1. Place an [Input] and a [Button].
  2. Add any validation to the [Input] under [Validation].
  3. Enter {{ input1.invalid }} in the [Disabled] for the [Button].

Setting Conditions to Disable the Button Using Logical Operators

  1. Place two [Input] s and one [Button].
  2. Set validations for [input1] and [input2] respectively.
  3. Enter {{ input1.invalid || input2.invalid }} in the [Disabled] for the [Button].

Setting Conditions to Hide the Button for Certain Users

  1. Click [Create] in the [Dataflows] and change the data flow name to isButtonDisabled.
  2. Select JavaScript in [Select resource].
  3. Enter the following script in [Script]: Assuming the scenario where the button is disabled when users example01@querier.io and example02@querier.io are logged in.
const disabledEmails = [
  "example01@querier.io",
  "example02@querier.io"
]
 
return disabledEmails.includes({{ querierCurrentUser.email }})
  1. Open the [Inspect] for the [Button] and enter {{ isButtonDisabled.data ? "You do not have permission to execute" : "Execute" }} in [Label].
  2. Enter {{ isButtonDisabled.data }} in [Disabled].