Tip 31: How to make a field in a Zoho Creator form mandatory based on criteria

Tip 31: How to make a field in a Zoho Creator form mandatory based on criteria

Hi folks,

 

I'm sure most of you are familiar with the Mandatory property available in our form builder. It enables you to ensure that your users enter an input in a required field. If they don't enter an input in that field, they'll be unable to submit the form. All you need to do is select the required field and just enable (check the box) the Mandatory property that you'll find in the Field Properties pane.



Whenever a mandatory field is left empty during form submission, a default alert message will pop up and prevent form submission.

                                                         

This remains static for all users and doesn't override on any condition. However, there is a way to bypass this and allow a form to be submitted even without the mandatory field value. This tip will help you understand how to make a field mandatory based on a particular condition or criteria.

Let's take the example of an Employee Leave Form, which employees use to apply for leave. Regardless of the number of days employees plan to take off or have already taken, they need to add a record using the Employee Leave Form while applying for leave. While entering the details, they can choose from different leave types available. By default the five basic categories are: Sick Leave, Casual Leave, Compulsory Off, On Duty, and Others. The employees can choose Others if their reason doesn't fall in any of the above choices. However, if the employee selects the Others option and submits the form, the person approving the leave needs to know the reason to either approve or reject it. 

If you mark the Leave Type field as mandatory, this wouldn't work if the user chooses the Others option. Hence, we've come up with a workaround—marking a field mandatory based on a condition using Deluge. 

Let's go through it step by step.

Step 1: Create the form, with all the required fields

First, let's create a Leave Form to capture all the details. Here, we've used the following fields:
  •  Name (Name Field)
  •  Email (Email Field)
  •  Employee ID (Single Line field)
  •  Start Date (Date Field)
  •  End Date (Date field)
  •  Leave Type (Radio Button)
  •  Reason (Multi Line Field)
Please note that the Reason field is used to enable employees to enter the reason for their leave if they select the "Others" option in the Leave Type field.




Step 2: Hide the Reason field when the form loads

 

Whenever the employee selects Others in Leave Type , they need to fill in the reason for it in the Reason  field. However, we can hide the field otherwise and show it only when the employee selects Others. To do that, we can create a simple workflow on the "Created or Edited - Load of the Form" condition using the below script.



  1. hide Reason;


Step 3: Show the Reason field only when the employee selects the Others option

 

As mentioned earlier, if the user selects the Others option in the Leave Type field, then the Reason field needs to be shown. For that, create a workflow in "Created or Edited - User input of field" on the Leave Type field using the the below script.

  1. if(input.Leave_Type == "Others")
  2. {
  3.  show Reason;
  4. }
  5. else
  6. {
  7.  hide Reason;
  8. }


Step 4: Mark the required field as mandatory using Deluge

 

Here comes the important part of configuring the Reason field as mandatory whenever the user selects Others as the leave type. For this, we can use a simple if statement to validate the leave type and prompt them to enter the reason. If the users selects the Others option, they have to enter details in the Reason field as well.

 

If the Reason field is empty, then we can display an alert asking the user to fill in the reason for their leave. Create a workflow with "Created or Edited - Validation on form submission" and this part of the workflow will get triggered once the user clicks the Submit button of the form.

  1. if(input.Leave_Type == "Others" && input.Reason == "")
  2. {
  3. alert(Reason,"Kindly mention the reason for the leave");
  4. cancel submit;
  5. }
Check the below-image to see how the validation works in the live form and the alert gets displayed. On clicking the Submit button, a validation will run to check if the Reason field is left empty. If it is empty, it will prevent form submission and an alert message will be shown in the pop-up.



In order to notify the user which field has to be filled, we're using the Inline Alert. Once the user clicks the OK button in the above error pop-up, an alert with our customized message will be displayed below the respective field, as shown in the image below.


We hope you try out this tip out for when you need to make a field mandatory based on conditions. We'll get back to you soon with another useful tip!


    Access your files securely from anywhere


              All-in-one knowledge management and training platform for your employees and customers.






                                    Zoho Developer Community




                                                          • Desk Community Learning Series


                                                          • Digest


                                                          • Functions


                                                          • Meetups


                                                          • Kbase


                                                          • Resources


                                                          • Glossary


                                                          • Desk Marketplace


                                                          • MVP Corner


                                                          • Word of the Day


                                                          • Ask the Experts





                                                                    Manage your brands on social media



                                                                          Zoho TeamInbox Resources



                                                                              Zoho CRM Plus Resources

                                                                                Zoho Books Resources


                                                                                  Zoho Subscriptions Resources

                                                                                    Zoho Projects Resources


                                                                                      Zoho Sprints Resources


                                                                                        Qntrl Resources


                                                                                          Zoho Creator Resources



                                                                                              Zoho CRM Resources

                                                                                              • CRM Community Learning Series

                                                                                                CRM Community Learning Series


                                                                                              • Kaizen

                                                                                                Kaizen

                                                                                              • Functions

                                                                                                Functions

                                                                                              • Meetups

                                                                                                Meetups

                                                                                              • Kbase

                                                                                                Kbase

                                                                                              • Resources

                                                                                                Resources

                                                                                              • Digest

                                                                                                Digest

                                                                                              • CRM Marketplace

                                                                                                CRM Marketplace

                                                                                              • MVP Corner

                                                                                                MVP Corner









                                                                                                  Design. Discuss. Deliver.

                                                                                                  Create visually engaging stories with Zoho Show.

                                                                                                  Get Started Now


                                                                                                    Zoho Show Resources

                                                                                                      Zoho Writer

                                                                                                      Get Started. Write Away!

                                                                                                      Writer is a powerful online word processor, designed for collaborative work.

                                                                                                        Zoho CRM コンテンツ




                                                                                                          Nederlandse Hulpbronnen


                                                                                                              ご検討中の方





                                                                                                                        • Recent Topics

                                                                                                                        • Unbundle feature for composite items

                                                                                                                          We receive composite items from our vendors and sell them either individually or create other composite items out of them. So, there is a lot of bundling and unbundling involved with our composite items. Previously, this feature was supported in form
                                                                                                                        • Inventory Barcode Creation - Add Picture of Item

                                                                                                                          Hi I am trying to set up bar code labels and include a picture of the item on the label - any idea on how to add that field to the barcode generator?
                                                                                                                        • CNIL - Suivi de Pixel

                                                                                                                          Bonjour à tous, À la suite de la nouvelle recommandation de la CNIL sur les pixels de suivi dans les e-mails, savez-vous si Zoho Campaigns permet : de conditionner le suivi des ouvertures au consentement de chaque contact ; de proposer un lien permettant
                                                                                                                        • Gemini Action - Add "inineData" Support

                                                                                                                          Thank you guys for adding a Gemini action. I like Gemini models for the "grunt work" of AI, as they have the cheapest tokens of the trustworthy providers One thing that's missing in the action, though, is the ability to pass file data. If you pass a base64-encoded
                                                                                                                        • Protect backed up and exported data using password encryption

                                                                                                                          Hello everyone, Protecting live data is crucial for any organization or product, as it contains sensitive customer information. However, protecting data does not end within the platform. Backup and export files often contain sensitive information and
                                                                                                                        • Zoho Projects - Cloning a task does not trigger task workflow when created

                                                                                                                          Hello! I have a Project where my team uses a set of tasks from a tasklist as templates, so we could simply clone it and drag it to another list in kanban view to avoid creating a new one from scratch. The process works well, but after cloning it the new
                                                                                                                        • Best way to setup Inventory bin tracking for products with multiple boxes/crates

                                                                                                                          Hi - we need some advice from the community on setting up Items in the Inventory for products with multiple crates. We have large products in our warehouse where the product is delivered as two large (double pallet) crates. We've setup the Items for these
                                                                                                                        • not able to access Zoho from home WIFI

                                                                                                                          for some reasone i am not able to access Zoho on my laptop or my iphone while i am connected to my home Wifi, i am able to access these sites both on laptop as well as Iphone and associated apps on any other Wifi as well as when I am on my 4G connection
                                                                                                                        • Five Guided Conversations Updates in Zoho Desk

                                                                                                                          Hello everyone, Guided Conversations is getting updates that make it easier to create more inclusive customer experiences, retain important conversation context, customize your widget, keep track of changes, and connect with external services. Here are
                                                                                                                        • An important update for Zoho Cliq desktop users

                                                                                                                          The latest version of the Zoho Cliq desktop app (v1.8.0) will no longer be supported on macOS 10.15 Catalina and earlier versions. This is because the framework we use (Electron) no longer supports some older macOS versions. If you’re using macOS 10.15
                                                                                                                        • Simplify eSignatures: Automate document workflows with Zoho WorkDrive

                                                                                                                          Hello everyone, We’re excited to invite you to our upcoming live webinar, where Zoho WorkDrive and Zoho Sign will come together to show you how to simplify and automate document workflows. From creating and collaborating on documents to approvals, e-signatures,
                                                                                                                        • Function #7: Fetch a value from Deal in Zoho CRM to the related Estimate in Zoho Books

                                                                                                                          We're here with another function for those using the integration with Zoho CRM. You know that potentials can be linked to transactions in Zoho Books. But if you're including additional details about a Deal (potential) in Zoho CRM and you want to inherit
                                                                                                                        • Turn off workflow Applied pop-up

                                                                                                                          hi We are new to Desk. I have a rule to set to "waiting for customer" when agent sends reply. This comes up every time. How to i turn off? Or am i seeing as admin.
                                                                                                                        • Workflows being applied and the Large unwanted popup

                                                                                                                          When a workflow is being applied do to an action, then the Agent is left with a large Window asking if they would like the see the changes this workflow did. Is there any way to disable this prompt from appearing?
                                                                                                                        • Maintenance notice for Zoho CommunitySpaces US data centers on August 23, 2026

                                                                                                                          Dear customers, We have scheduled a maintenance activity for Zoho CommunitySpaces in our United States (US) data centers on August 23, 2026, from 1:30 a.m. to 2:00 a.m. During this 30-minute maintenance window, Zoho CommunitySpaces will be temporarily
                                                                                                                        • Knowledge base: The nitty-gritty of SEO tags

                                                                                                                          A well-optimized knowledge base with great SEO can benefit your company by allowing customers to find help articles and support resources using search engines. This enables customers to quickly and efficiently find the information they need without direct
                                                                                                                        • zoho desk: Can tickets be created from Microsoft Teams messages?

                                                                                                                          I am trying to see if there is a way to integrate Microsoft teams with zohodesk. we have a few customers who prefer to communicate requests through Teams, and it would be great to create tickets when they do.
                                                                                                                        • ´´Send Email Reply´´ action does not work when the message body contains placeholders.

                                                                                                                          Hi Community, I am working on a workflow where the Customer contact is notified via email when their ticket status goes On Hold. To do that, I chose the Send Email Reply action, and the minute I add a placeholder, the workflow does not work and the ticket´s
                                                                                                                        • Zoho ERP | Product updates | July 2026

                                                                                                                          Hello users, We're back with another round of updates to help you streamline your operations. This month's release brings new features and enhancements designed to help you work more efficiently. Read on to discover everything that's new in Zoho ERP this
                                                                                                                        • Zoho Forms Spam Submissions

                                                                                                                          Hello community! It seems that after updating the Recaptcha settings on our newsletter form (Zoho Forms), we keep getting low quality spam emails subscriptions. I first used 0.5 treshold on invisible google captcha, then raised it to 0.7 but to no avail.
                                                                                                                        • Migration from Hosted Exchange Server

                                                                                                                          I am looking for documentation on how to migrate from a hosted version of Microsoft Exchange to Zoho Mail.  The existing material is very good for non-hosted Exchange or local Outlook account but I have been unable to locate information to move from a hosted Exchange environment. This is complicated by not being able to have access to the Exchange Server (other than login credentials) and the lack of a local PST file (local Outlook uses OST files). I am to the point that all I need to do is migrate
                                                                                                                        • Zoho Visual Editor Not Opening

                                                                                                                          Hello There I am trying to build a website using zoho and I can't open the visual editor. It keep saying Loading...  Do you know why it is happening. Thanks in Advance Regards Rajat
                                                                                                                        • Subform edits don't appear in parent record timeline?

                                                                                                                          Is it possible to have subform edits (like add row/delete row) appear in the Timeline for parent records? A user can edit a record, only edit the subform, and it doesn't appear in the timeline. Is there a workaround or way that we can show when a user
                                                                                                                        • Unable to view existing or create new WhatsApp IM templates on Zoho Desk

                                                                                                                          Hi there, Is there a issue with WhatsApp templates in Zoho Desk currently [17 Aug 2026]? I am unable to view existing or create new WhatsApp IM templates. It's saying "Oops, something went wrong. Please try again later."
                                                                                                                        • WhatsApp Business Calling API

                                                                                                                          Dear Zoho SalesIQ Team, I would like to request a feature that allows users to call WhatsApp numbers directly via Zoho SalesIQ. This integration would enable sending and receiving calls to and from WhatsApp numbers over the internet, without the need
                                                                                                                        • Automating CRM backup storage?

                                                                                                                          Hi there, We've recently set up automatic backups for our Zoho CRM account. We were hoping that the backup functionality would not require any manual work on our end, but it seems that we are always required to download the backups ourselves, store them,
                                                                                                                        • Zoho CRM Kiosk Upload Files

                                                                                                                          Hello all, We are trying out Kiosks at the moment to see where it can fit best in our business. We are still a bit off in the application but lets say we will sort this out. My question is the following - when I create a Kiosk I can add "File Upload"
                                                                                                                        • Add Support to Upload Inventory Items with Categories or Enable Separate Upload for Inventory Categories

                                                                                                                          Currently, Zoho Inventory does not support uploading new items along with their parent and sub inventory categories using the item import feature. This creates challenges for businesses with structured inventory hierarchies when trying to upload items
                                                                                                                        • About products & categories URL

                                                                                                                          hello guys, I'm trying to migrate date from Magento 2 to Zoho Commerce and I have some doubt about URL. In my M2 for product I have "Url Key" field with value like this: "product-url" and page appear like this: "www.sitename.com/product-url.html" In ZC
                                                                                                                        • Which Zoho CRM tasks would you want an AI assistant to handle?

                                                                                                                          I’ve started delegating my Zoho CRM work to AI – and many tasks now take me half the time. It has been so useful that we’re now working to make it available to everyone. Instead of clicking through records and tabs, I simply describe what needs to be
                                                                                                                        • Export Campaign to another document?

                                                                                                                          How can I export my Campaign to Word and PDF? I want to create a PDF archive on my website with old campaigns /Peter
                                                                                                                        • Filter isn't

                                                                                                                          The ability to filter the history of a given flow to a specific status however it would be great to have the ability to filter to a status that isn't something for example if i want to find all history that isn't complete.
                                                                                                                        • LinkedIn RSC is now live in Zoho Recruit

                                                                                                                          LinkedIn Recruiter System Connect (RSC) is here. Your Zoho Recruit data (candidates, jobs, notes, stage updates, resume attachments, and more) now syncs with LinkedIn in real time. Note: LinkedIn RSC is included with your LinkedIn Recruiter Corporate
                                                                                                                        • What's New in Zoho Inventory | April & May 2026

                                                                                                                          Hello users, We're excited to roll out the latest Zoho Inventory updates for April and May 2026. These enhancements are designed to make your daily operations smoother and more efficient, from advanced inventory management and flexible pricing to automated
                                                                                                                        • Old Gmail inbox migration to Zoho mail

                                                                                                                           Hi, I have been checking Zoho products for a while. This week finally decided to migrate my company mail accounts from Gmail to Zoho. I was looking for sometime and could not found a way to perform this; only found the way to take a backup of my old account into Zoho connecting throught pop3 server; but I'm not looking for that, I want that in my new Zoho Mail inbox appear all my mail messages and conversations as I see it in Gmail. Searching in Google and in Zoho Mail docs the workaround begun
                                                                                                                        • Zoho CRM Copilot Connector

                                                                                                                          Hello, Are there plans to release a connector for Zoho CRM and Copilot? I'm in the early research stages of potentially switching our CRM solution to Microsoft Dynamics because of its out of the box integration with Copilot. The advantage being that we
                                                                                                                        • 100 Rows in a Subform is too limited

                                                                                                                          We have a custom Module in CRM called Price Sheets, when we get a PO from a client we add the items from the PO to it and then check with our vendors for pricing and add our margin etc And after it is complete we have setup custom scripts to create a
                                                                                                                        • Drop Down Menu - Adding up values

                                                                                                                          I have a form that has 22 drop down fields each having a value of 0-10 to choose from. Is it possible to have it add up the total value of those selected numbers and have it tally it up in another field at the end? So example: if each of the 22 fields
                                                                                                                        • [Webinar] Conversational AI: The new paradigm for agentic analytics

                                                                                                                          From hard coding to powerful agents, data and analytics is undergoing a tectonic shift, and conversational agents are at the forefront of this transformation. This goes beyond democratizing business intelligence; it's about accelerating the path from
                                                                                                                        • Make Rich Text fields available in Canva Print Views

                                                                                                                          Everything is on the title. I don't really understand why this is not already possible as Rich Text Fields are available in Canva Detailed Views for example.
                                                                                                                        • Next Page