> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.opnform.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🧠 How do I add logic to my form?

Form logic lets you create **smart, dynamic forms** that react based on user input.
With **OpnForm**, every field can have its own logic rules to **show, hide, require, or make optional** based on specific conditions.

## ⚙️ Available Logic Actions
You can trigger **four types of actions** when conditions are met:
* ✅ **Make field required**
* 🚫 **Make field optional**
* 👀 **Show field** (if currently hidden)
* 🙈 **Hide field** (if currently visible)

## ✨ How to Set Up Logic for a Field
1. Open your **form editor**.
2. Click the **Settings icon** next to the field you want to configure.
3. In the modal that appears, open the **Logic** section.
4. Set your **conditions** (for example: *If answer to Question 1 is Yes*).
5. Choose the **action(s)** you want to trigger.
6. Click **Publish**— and you’re done! 🎉
Your form will now respond dynamically based on user input.


![](https://storage.crisp.chat/users/helpdesk/website/-/1/b/5/b/1b5b982fc3df6500/chromehkgku9f1ov_1y7pwmz.png)




## 📅 Date Logic Conditions
Date logic lets you create **time-sensitive form behavior** based on how recent or upcoming a selected date is. This is useful for things like deadlines, reminders, or event scheduling.
### ⏰ Available Date Logic Options
| Condition | Description | Example |
| ---- |
| **At Least X Days Ago** | Triggers when the date is X or more days in the past. | “At least 7 days ago” → matches anything older than a week. |
| **At Least X Days From Now** | Triggers when the date is X or more days in the future. | “At least 7 days from now” → matches anything a week or more away. |
| **Within Past X Days** | Triggers when the date falls within the last X days, including today. | “Within past 7 days” → matches dates from last week through today. |
| **Within Next X Days** | Triggers when the date falls within the next X days, including today. | “Within next 7 days” → matches today through next week. |
### 💡 Example Use Cases
* ⚠️ Show a “Late Submission” warning for dates more than 30 days in the past.
* 📝 Require additional information for events happening within the next 7 days.
* 🚫 Hide certain options for events too far in the future.
Date-based conditions make it easy to create **responsive, time-aware forms** that adapt automatically.

## ❓ FAQ
### Why don’t I see the “Show” or “Hide” options?
These actions are **context-based**:
* 🔒 “Show” only appears if the field is currently hidden.
* 👁️ “Hide” only appears if the field is currently visible.
If you don’t see one of these options, make sure the field is in the correct state.

## 🎥 Example: Showing a Hidden Field
Here’s a quick demo using the **“Message”** input field.
In this example, the “Message” field starts off hidden and only appears when the user selects **“Option 1”** from a Select field.
📽️ *Watch it in action below.*



${vimeo}[](1111289567)




