Toggle menu

Using the Script Editor - Showing and Hiding Form Fields

3. Hiding the fields

You should now have a form with three input fields which looks like this:

Three fields for contact details
 

Hiding fields using the initialisation handler

When the form is first displayed, we want to hide the fields for contact details until the user picks how they'd like to be contacted. To do this, first find the "Client Init Handler" in the "Page Settings" tab:

Page Settings Init Handler
 

Then open the script editor:

Client Init Code Editor
 

You can write the script by adding blocks to it. In the "Form Fields" category, there's a block called "hide field..."

Hide Field Block
 

Drag the field into the work area and add it to the function block. The block will snap into place when you drop it:

Function with one block
 

The text "LAYOUT" is the name of the field that will be hidden. Click on the text to display a list of all of the fields in your form. Pick the field you'd like to hide:

List of Fields
 

Add two more blocks and update the field that will be hidden by each one:

Hiding Three Fields
 

Now when your form is displayed, all three fields will be hidden. If your form is already published on your site you can try this out now by saving and publishing your changes.

Last modified on February 15, 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon