On this page
"Conditional logic" sounds like something you'd need a computer science degree for. It isn't. It's mostly the form equivalent of a good waiter: don't ask about dessert before the main course, don't offer wine to someone who just said they're driving, and remember people's names.
In this guide we'll build one real form together and use most of the "smart" features HornetForms has along the way. Our example: a small café that does catering, and wants a quote form that doesn't make anyone do maths in their head.
Meet Bean There, a fictional café with very real sandwich ambitions. Their quote form needs to:
- Ask for a name and an email.
- Ask how many guests are coming and whether they need a coffee bar.
- Only ask about coffee details if they said yes.
- Work out an estimated price automatically.
- Remember where the visitor came from (an Instagram ad, a flyer, the website).
- Politely turn away events that are too big for a small café.
- Send happy customers to a booking page afterwards.
In HornetForms you write this like a document: type /, pick a question type, give it a label. Page one gets "Your name" (short text) and "Email" (email). Page two gets "How many guests?" (number) and "Do you need a coffee bar?" (multiple choice: Yes / No), followed by "Which drinks?" (checkboxes).
Now let's make it smart.
Conditional logic: show, hide and jump#
Logic in HornetForms is a list of simple rules: when something is true, then do something. Open a question's logic (there's even a shortcut, Alt+Shift+L) and add a rule.
Show and hide. Nobody who said "No" to the coffee bar wants to pick drinks. So:
- When "Do you need a coffee bar?" is "Yes", show "Which drinks?"
That's it. The drinks question is hidden until it's needed, and if someone changes their answer back to "No", it disappears again.
Jump. Bean There can't host 300 people, however much they'd like to. Instead of letting someone fill in the whole form only to get a polite "sorry" email two days later, we can tell them right away:
- When "How many guests?" is greater than 80, jump to the ending "Too big for us".
A jump can go to another page or straight to an ending. More on endings in a minute.
A tip from experience: add rules one at a time and check each in the Preview tab before adding the next. Logic is easy; logic you wrote at 11 p.m. without testing is where the bugs live.
Answer piping: use what people told you#
Piping means putting an earlier answer into later text. In HornetForms you type @ in a question label, description, heading or paragraph and pick the answer you want to insert.
So the heading on page two can say:
Lovely to meet you, @Your name! Tell us about your event.
When Sam fills in the form, they see "Lovely to meet you, Sam! Tell us about your event." Small touch, big difference. It feels like a conversation instead of a tax return.
Piping works in more places than you'd expect:
- Question labels and descriptions
- Headings and paragraphs
- Endings (the thank-you screens)
- Redirect URLs, where the values are URL-encoded for you
- The subject line of your own notification emails, so your inbox says "New catering request from Sam" instead of "New response #47"
Calculations: let the form do the maths#
Here's the part Bean There is most excited about. Add a calculated field called "Estimated total" and give it a formula. Use "Insert field" to drop the guest count in, and it shows up as @How many guests?. The formula:
round(@How many guests? * 12.5)
Formulas support +, -, *, /, parentheses and a handful of functions: round, floor, ceil, abs, min and max. That's enough for most real-world pricing. For example, a minimum order of 150:
max(150, round(@How many guests? * 12.5))
Now pipe the result into a paragraph on the last page: "Your estimated total is @Estimated total." The respondent sees a live number while they fill in the form.
One detail we're quietly proud of: the server recalculates every calculated value when the form is submitted. So the number you see in your responses is the real result of the formula, even if someone gets creative with their browser's developer tools.
The same feature powers quizzes: give each correct answer a point with a calculation and show the score at the end.
Hidden fields: know where people came from#
Bean There advertises in three places and wants to know which one works. Add a hidden field called source. Respondents never see it, but it's filled from the address of the link:
https://forms.hornetforms.com/f/catering?source=instagram
Put ?source=flyer on the QR code on the flyer, ?source=instagram in the ad, and so on. Every response now carries its source, and you can filter your responses by it. Hidden fields can be piped like any other answer, so you could even greet people with "Welcome, @source friend!". Maybe don't, though.
Endings and redirects: finish in the right place#
A form doesn't have to end with one generic "Thanks!". HornetForms lets you add up to 20 named endings besides the default thank-you page, and logic decides which one people see.
For Bean There we need two:
- "Too big for us": a friendly note saying the event is larger than the café can handle, with a recommendation to call for ideas. The jump rule from earlier sends people here.
- The default thank-you page: "Thanks, @Your name! Your estimate is @Estimated total. We'll confirm within a day."
And for the happy path, a redirect can send people somewhere else after they submit, like the café's booking page. Redirect URLs can be piped too:
https://beanthere.example/book?name=@Your name&guests=@How many guests?
HornetForms URL-encodes the values for you, so a name like "Sam & Alex" won't break the link. (In the editor, those @ bits are real answer chips you insert, not typed text.)
What we built#
Let's recap. One catering form that:
- Hides questions that don't apply
- Turns away oversized events before anyone wastes time
- Greets people by name
- Calculates a price, and double-checks it on the server
- Tracks which ad or flyer brought each visitor
- Ends in the right place and hands people over to booking
None of it needed code. If you want a head start, the built-in "Quote request" template is a good base to add this to. We picked ten more in 10 form templates to steal this week.
Try it yourself#
Logic, piping, calculations, hidden fields and endings are all part of HornetForms today, and they're all on the Free plan, which stays free forever. See the details on the features page and what's coming in Pro and Business on the pricing page. Sign-ups are invite-only for now, so join the waitlist and we'll let you in as soon as we can. Bring your own sandwiches.