Show or Hide field on checkbox input

Show or Hide field on checkbox input

Requirement

Show or hide a field based on the checkbox value.

Use Case

An ice-cream parlour is accepting orders online. The patrons can choose from a list of available flavours, toppings etc.
 
See how it works

Steps to follow

1. Create the form with the following details:
Form
Form Link Name
Field Type
Field Name
Field Link Name
Order One
Order_One
Drop Down
Ice Cream Flavours
Ice_Cream_Flavours
Drop Down
Toppings
Toppings
Checkbox
I have one more request
I_have_ one _more_request
Drop Down
Personalisation
Personalisation
Name
Name
Name
Address
Address
Address

2. Create a workflow to hide the Personalisation field on load of the Order One form.
 
3. Add the below code in the Deluge Editor:
  1. hide Personalisation;
4. Now, we shall create a workflow to show the Personalisation field when the I have one more request checkbox is checked.
 
5. Add the below Deluge code in the editor:
  1. if(I_have_one_more_request == "Yes") {
  2. show Personalisation;
  3. }
  4. else
  5. {
  6. hide Personalisation;
  7. }

See how it works

Points to Note

  • Decision boxes can also be used in place of checkboxes to achieve this functionality. A sample Deluge code is as follows:
  1. if(Decision_Box) {
  2. show Personalisation ;
  3. }
  4. else {
  5. hide Personalisation;
  6. }