Learn & Support · Forms and logic
Show or hide fields based on an answer
A delivery address that appears only when someone chooses Delivery.
Watch the presentationA 1:27 video; captions under CC. The steps are below too.
Add the question
Open the Cupcake Order form from Calculate a total, choose Fields, then Add Fields to this Form. Choose Select, then options; in its Settings, label it Pickup or delivery, add Pickup and Delivery, and choose Submit.
Add the field to show
Choose Input, then text, and label it Delivery address. It’s only needed for deliveries.
Write the logic
In Form Logic, choose Write as text. Under on load, add call hidefield("Delivery address"). Then add on change "Pickup or delivery": if it’s "Delivery", call showfield("Delivery address"); else, hidefield. Choose Check, then Apply.
It starts hidden
Open the form from Sharing, Open Link. There’s no address field until it’s needed.
Delivery shows it
Choose Delivery, and the address field appears.
Pickup hides it
Change it to Pickup, and it’s hidden again. For a simple rule like this, a field’s Show only if setting does the same with no logic; logic can also do more in the same place, such as setting a delivery fee.
Go deeper
Text and choice fields
Collect cleaner information with fields that tidy input, limit choices and adapt to each answer.
Take the tour →Jade: logic meets love
Build calculations, decisions and actions from lists, with every function explained as you go.
Take the tour →Jade Functions
Text, number, date, money, validation, AI and action functions, each explained in plain words.
Take the tour →