Conditional Forms
Display Form Fields based on your custom Form Field Condition with Canvas.
Usage
<div class="col-12 form-group mb-0">
<div class="form-check">
<input id="conditional-form-tos" name="conditional-form-tos" type="checkbox" class="form-check-input" value="1">
<label class="form-check-label" for="conditional-form-tos">By checking this you agree to the <span style="text-decoration:underline dotted; text-underline-offset: 0.375rem;">Terms of Service</span></label>
</div>
</div>
<div class="col-12 form-group mb-0" data-condition="==" data-condition-target="conditional-form-tos" data-condition-value="1">
<button id="conditional-form-submit" name="conditional-form-submit" type="submit" class="btn btn-dark mx-0">Submit Message</button>
</div>Note: The above code will display the Submit Message Button when the
Terms of ServiceCheckbox is checked.
How to Use
- 1
Step 1
Add the
data-conditionAttribute to the Input Wrapper to activate the Conditional Input - 2
Step 2
Set the
data-condition-targetAttribute on the Conditional Input Wrapper to check the condition against the Target Input. - 3
Step 3
Set the
data-condition-valueAttribute on the Conditional Input Wrapper to satisfy the condition value of the Target Input.
Settings
| Setting | Description |
|---|---|
data-condition | Condition of the Input Example: == |
data-condition-target | The Target Input to match the Condition against. Must match the ID attribute of the Target InputExample: conditional-form-tosTarget is #conditional-form-tos |
data-condition-value | Value to match the value attribute of the Target InputExample: 1If the Value of the Checkbox Input is 1. You can change the Values as you please. |
data-condition-check | Type of Check to perform on the Conditional Input Wrapper against the Target Input Example: validateIf you set the data-condition-check Attribute as validate, the Conditional Input Wrapper will be display once the Target Input is valid |
Extras
<div class="col-6 form-group mb-0">
<label for="conditional-form-email">Email Address</label>
<input id="conditional2-form-email" name="conditional-form-email" type="email" class="form-control required">
</div>
<div class="col-12 form-group mb-0" data-condition="==" data-condition-target="conditional2-form-email" data-condition-check="validate" data-condition-value="true">
<button id="conditional2-form-submit" name="conditional-form-submit" type="submit" class="btn btn-dark mx-0">Submit Message</button>
</div>