Form Change Handler

Form Change Handler

Overview

The form change handler can be used when the fields in the form dialog box should dynamically change values based on the user input. It can be also used to validate the user input and display an error message in case the input doesn't match with the criteria set by the menu creator.

How to enable the form change handler?

Set the value of the triggerOnChange attribute in the field object as true.

Implementation of the form change Handler

The information will be passed through the following parameters to the form change handler.
 
form
Input collected from the user
user
Details of the user executing the menu.
entity
Details of the entity in which the menu is being used.
target
Details of the form field in which the value has been changed.
network
Details of the network in which the menu being.
Table 1 (Parameters of form change handler)

Whenever the user input is made in the field, the form change handler will be executed. Using the form change handler you can add new fields to a form, update or remove the existing ones depending on the user input. The attributes in this handler response are as follows:
 
Attribute
Property
Description
fields
Type: JSONArray
Maximum limit:  20
Array of field objects that you want to add or update in the form
remove
Type: JSONArray
Maximum limit:  20
Array of field names that you want to remove from the form.
error
String (50)
The error message that has to displayed for the entire form.
fieldError
JSONObject
Error message for an individual field.  
(Refer to Table 2 in this document to add error message for each field.)
Table 2 (Attributes in handler response) 

Within the JSONObject of the fieldError, you can include the error message for each field using the attribute given below:
 
Attribute
Property
Description
fieldName
 
(the name of the field in which you'd like to display the error message should be used as attribute. eg: startDate)
String (200)
The error message to be displayed  for each field.
 
In general, new fields are inserted at the bottom of the form. However, by using the attributes: after and before, new fields can be inserted in the middle of the form ( before or after a particular field). You can use these attributes within the field object in the form change handler. 
 
Attribute
Property
Description
Pre-requisite
after
String (20)
Enter the name of the field that has to be inserted/moved next to the particular field
Optional
before
String (20)
Enter the name of the field that has to inserted before/moved up before the particular field
Optional

The form change handler will not be executed in the following cases:
  1. The field object's triggerOnChange value is true, but the function is not written the form change handler. 
  2. Or, the function is written in the form change handler, but the field object's triggerOnChange value is false.
 
A sample code to add 'Assignee' field after 'Project' field in a form is as follows: 
  1. "fields": [

        {

          "before": "taskDueDate",

          "hint": "Select the projects",

          "name": "Project",

          "options": [

            {

              "label": "UI Enhancements",

              "id": "13429993739813",

              "value": "13429993739813"

            }

          ],

          "label": "Project",

          "type": "multiSelect",

          "mandatory": "false"

        },

        {

          "hint": " Select assignees",

          "name": "Assignee",

          "options": [],

          "label": "Assignee",

          "after": "Project", // To add the field after 'Project' field.

          "type": "select",

          "mandatory": "false"

        },

        {

          "hide": "false",

          "name": "taskTitle"

        },

        {

          "hide": "false",

          "name": "taskDesc"

        },

        {

          "hide": "false",

          "name": "taskDueDate"

        } ] }


Sample code to display an error message for an individual field: 
  1. {

    "fieldError":{

    "endDate":"The end date must be greater than the start date." }

    }

Sample code to display error message for the entire form: 
  1. {

    "fields":[

    {

    "name":"dLang",

    "value":""

    }

    ],

    "error":"Sorry, we're unable to translate the text to the selected language." }



    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 Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          CRM Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real Estate Kiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives Security & Compliance
                          Holiday Forms Google Forms alternative  GDPR
                          Form to PDF Jotform alternative HIPAA Forms
                          Email Forms
                          Encrypted Forms
                          Embeddable Forms
                          Secure Forms
                          Drag and Drop form builder
                          WCAG


                                            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

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      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 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









                                                                                                              • Related Articles

                                                                                                              • Form Submit Handler

                                                                                                                Overview The form submit handler is triggered when the user clicks the submit button in the form. This handler is used to validate the input data entered by the user and perform the custom menu's intended action. Implementation of Form Submit Handler ...
                                                                                                              • Field Lookup Handler

                                                                                                                Overview The field lookup handler can be used to fetch values for field options from external services in real-time. The two main instances are as follows: The field may require updated options from external services in real-time. In such cases, the ...
                                                                                                              • Menu Click Handler

                                                                                                                Overview The menu click handler will be triggered whenever the user selects the custom menu option from the dropdown. It can be used to perform a simple one-step action such as sharing a post link to a particular user on Cliq, or  open a form to ...
                                                                                                              • Custom Menu - an overview

                                                                                                                Feature Availability Overview Custom Menu in Zoho Connect lets you add customized menus to entities such as status, tasks, events, in addition to the default menus—Follow, Print, Bookmark, and Copy post URL that are already available. They can be ...
                                                                                                              • User Sync in Zoho Connect

                                                                                                                Feature Availability Overview Most organizations use enterprise directory systems (such as Active Directory or LDAP) to maintain employee, group, and application information. For larger organizations, it can be difficult to manually add and manage ...
                                                                                                                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