How to implement a Validation Logic to Zoho Survey Questions

How to implement a Validation Logic to Zoho Survey Questions

Requirement Overview

A Zoho Survey user wants to display an error message whenever the customer answers Question A with a value less than 10% of Question B.

Use-case

Loan Eligibility Check for a Real Estate Business: A real estate company uses Zoho Survey to pre-qualify potential homebuyers who are interested in purchasing property and seeking home financing. As part of this survey, they collect information about the user's intended purchase amount and the down payment they are willing to make.

The company wants to ensure that users are serious buyers and meet the minimum financing criteria. One such rule is that the down payment should be at least 10% of the purchase amount to qualify for in-house loan offers or partner bank financing.

Current Challenges to achieve this directly

As of now, we do not have a direct 'Validation Rule' feature to display an error message based on the customer input on the Zoho Survey questions.

Permissions & Availability

Notes
The Portal Admin user or users with Department Admin and User role can access the Survey's which are associated with the Department the user is part of.

Solution: Step-by-Step Implementation Guide

1) Please navigate to the respective survey for which you would like to perform the validation.

2) Drag and drop the 2 Number (Data Type) questions in the Question Builder and name them as Purchase Amount and Down Payment.

3) Drag and drop the Heading/Description question to display an error message whenever the Down Payment value is less than 10% of the Purchase Amount.

How will we apply the criteria to trigger and display an error message?

Two factors are involved in this case, one is Display Logic for the question Heading/Description, and the second one is Java Script where we are going to define the criteria to display an error message.
  1. Step 1: Display Logic

In the Display Logic of the Heading/Description field, please ensure that you've chosen Display this question only if a certain condition is met.
  1. Step 2: Condition

We will have to use two conditions here:

1) If Down Payment (Question) is Answered
AND
2) If Javascript Snippet returns True. 

Below is an image attached that shows Display Logic and Condition:


In the C2 (Condition 2), we will have to use the below sample code.
  1. var fieldA = application.survey.question.F.response;
  2. var fieldB = application.survey.question.G.response;
  3. if (fieldA && fieldB)
  4. {
  5. return fieldB < (0.1 * fieldA);
  6. }
  7. else
  8. {
  9. return false;
  10. }
Shared sample code explanation:

1. Using script, you would require to fetch 1st Field(Question F).

fieldA = F.response;
→ Gets the response value from question F.

2. Then, you would require to fetch 2nd Field(Question G).

fieldB = G.response;
→ Gets the response value from question G.

3. Then, use a IF condition and check if both the fields are empty or not.

if (fieldA && fieldB)
→ Checks that both fields have a response (i.e., neither is empty or null).

4. At last, fetch both field values and validate further.

return fieldB < (0.1 * fieldA);
→ If both fields have responses, it checks:
Is the response to question G less than 10% of the response to question F?

If the condition C2 is true, then it will display the Heading/Description question. Else, it will not display the Heading/Description question.

How "fieldA" and the "fieldB" captures the Purchase amount and the Downpayment?

We could capture it by using the "Insert Variable". The image below demonstrates the mentioned option. 

  1. Step 3: Validation criteria

In the Heading/Description question, navigate to the Description section >> On the right side of the Description section, you will find the 'Insert Variable' option, which is placed as a drop-down. Please choose the Custom Script (Javascript Snippet).


Now, you could update the below sample code which defines the Validation criteria
  1. var percentage = 10 / 100 * application.survey.question.F.response;
  2. if (application.survey.question.G.response < percentage)
  3. {
  4. return "Please enter a value greater than: " + percentage;
  5. }
Here, application.survey.question.F.response is a variable of the 1st question (Purchase Amount) and application.survey.question.G.response is a variable of the 2nd question (Down Payment) and within the Return, you could hard code the error message as per the business requirement.

Working Demo - Screencast


Roadmap

We do have this in our roadmap to support a default feature within Zoho Survey, which enables users to handle such validation with easier configuration in the future. 


QuoteCustom Solution Created by Hemanth Kumar L M | Zoho Partner Support

If you need any further clarifications, please don’t hesitate to contact partner-support@zohocorp.com.

NotesAdditionally, we kindly ask all Europe and UK Partners to reach out to partner-support@eu.zohocorp.com.


        Create. Review. Publish.

        Write, edit, collaborate on, and publish documents to different content management platforms.

        Get Started Now


          Access your files securely from anywhere

            Zoho CRM Training Programs

            Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

            Zoho CRM Training
              Redefine the way you work
              with Zoho Workplace

                Zoho DataPrep Personalized Demo

                If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

                Zoho CRM Training

                  Create, share, and deliver

                  beautiful slides from anywhere.

                  Get Started Now


                    Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                    BOOK A SESSION







                                Quick LinksWorkflow AutomationData Collection
                                Web FormsEnterpriseOnline Data Collection Tool
                                Embeddable FormsBankingBegin Data Collection
                                Interactive FormsWorkplaceData Collection App
                                CRM FormsCustomer ServiceAccessible Forms
                                Digital FormsMarketingForms for Small Business
                                HTML FormsEducationForms for Enterprise
                                Contact FormsE-commerceForms for any business
                                Lead Generation FormsHealthcareForms for Startups
                                Wordpress FormsCustomer onboardingForms for Small Business
                                No Code FormsConstructionRSVP tool for holidays
                                Free FormsTravelFeatures for Order Forms
                                Prefill FormsNon-Profit

                                Intake FormsLegal
                                Mobile App
                                Form DesignerHR
                                Mobile Forms
                                Card FormsFoodOffline Forms
                                Assign FormsPhotographyMobile Forms Features
                                Translate FormsReal EstateKiosk in Mobile Forms
                                Electronic Forms
                                Drag & drop form builder

                                Notification Emails for FormsAlternativesSecurity & Compliance
                                Holiday FormsGoogle Forms alternative GDPR
                                Form to PDFJotform alternativeHIPAA Forms
                                Email FormsFormstack alternativeEncrypted Forms

                                Wufoo alternativeSecure Forms

                                TypeformWCAG


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

                                                Create. Review. Publish.

                                                Write, edit, collaborate on, and publish documents to different content management platforms.

                                                Get Started Now




                                                                  You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                      Manage your brands on social media


                                                                        • Desk Community Learning Series


                                                                        • Digest


                                                                        • Functions


                                                                        • Meetups


                                                                        • Kbase


                                                                        • Resources


                                                                        • Glossary


                                                                        • Desk Marketplace


                                                                        • MVP Corner


                                                                        • Word of the Day


                                                                        • Ask the Experts


                                                                          Zoho Sheet Resources

                                                                           

                                                                              Zoho Forms Resources


                                                                                Secure your business
                                                                                communication with Zoho Mail


                                                                                Mail on the move with
                                                                                Zoho Mail mobile application

                                                                                  Stay on top of your schedule
                                                                                  at all times


                                                                                  Carry your calendar with you
                                                                                  Anytime, anywhere




                                                                                        Zoho Sign Resources

                                                                                          Sign, Paperless!

                                                                                          Sign and send business documents on the go!

                                                                                          Get Started Now




                                                                                                  Zoho TeamInbox Resources





                                                                                                            Zoho DataPrep Demo

                                                                                                            Get a personalized demo or POC

                                                                                                            REGISTER NOW


                                                                                                              Design. Discuss. Deliver.

                                                                                                              Create visually engaging stories with Zoho Show.

                                                                                                              Get Started Now








                                                                                                                                    Wherever you are is as good as
                                                                                                                                    your workplace

                                                                                                                                      Resources

                                                                                                                                      Videos

                                                                                                                                      Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                      eBooks

                                                                                                                                      Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                      Webinars

                                                                                                                                      Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                      CRM Tips

                                                                                                                                      Make the most of Zoho CRM with these useful tips.



                                                                                                                                        Zoho Show Resources