How To: Hide/Show Fields in Zoho Creator

A simple but often repeated query in Zoho Creator Help/Forums is how to dynamically hide and show fields in Zoho Creator forms. In this blog, we present how-to-do tips on using the Hide/Show functionality to create smart forms that hide irrelevant information from the user or adjust as the user is entering information.

1. Show fields only to the application owner

Assume you are the HR manager and you have created the following “Job Application” Form to enable applicants to apply for vacancies in your organization. In this form, the field Call for Written Test will be used only by the app owner (HR manager) to decide if the candidate must be called for an interview, and should not be displayed to users.

show field to application owner

To make the Call for Written Test field accessible only to the application owner, look for the Permissions section under the field properties and select the Show field toAdmin Only. Your changes will be saved automatically.

show field to admin only

Now, the field will be displayed in the form only if the login user is the application owner. Shared users will not be able to view this field.

The form will be displayed to users as shown below:

hide field to others


2. Conditionally Hide/Show fields

You can also conditionally show/hide specific fields in your form by adding a bit of Deluge Scripting. For example, if the user chooses “Option 1” on a drop-down field, show certain fields; otherwise, show some other fields.

The Hide <fieldname> Deluge task can be used to dynamically hide specific fields, when not required. The field will not be available for viewing/editing to both the owner of the application and to people with whom you are sharing the application.

The Show <fieldname>Deluge task is used to display a field that was previously hidden.


Here are a few sample scenarios:

a. Hide/Show fields based on value selected in another field

  • In the “Job Application” form given below, the multi-line field “Areas of research” is hidden when the form is loaded. It will be displayed only if the value of the field “Experience” is chosen as “Research”.

To achieve this,

  1. Select Form Actions ->  On Add -> On Load block in Script builder. The on Add -> on Load script is executed when the form is loaded to add a new record.
  2. Add the Deluge task hide Areas_of_research, as shown in the screen-shot below and click Save Script to update the changes.

(You can drag and drop each task to the editor area and use the Edit button to configure field names, variables and expressions using the Deluge Expression builder)

hide a field deluge

To display the field Areas_of_researchonly if Experience is selected as “Research”,

  1. Select Field Actions -> Type -> On User inputblock in Script builder. The Field Actions -> on user input script is executed when the Type field value is changed.
  2. Add the If condition and statements to display the field only if the Experience field is selected as “Research”, as shown below. Click Save Script to update the changes.

if else on Deluge

The Areas_of_research field is displayed if Experience is selected as “Research” as shown below.

show field based on another field

b. Hide/Show fields based on login user

Sometimes you may want to restrict access to certain users only to specific fields in your form. This can be achieved using the Deluge variable zoho.loginuser, which returns the name of the login user and the  Hide <fieldname> deluge task, within a If condition.

For example, assume you want to restrict edit access to the Name and E-mail field only to the HR Manager, whose login user name is “HR Admin”.

To achieve this,

  1. Select Form Actions ->  On Edit -> On Load block in Script builder. The on Edit -> on Load script is executed when the form is loaded to edit an existing record.
  2. Add the If condition to check for the login user name and the If statements to be executed . The If statements will be executed if the login user name is not “HR Admin”. (i.e) the Name and E-mail field will not be displayed for editing, if the loginuserid is not “HR Admin”.
  3. Click Save Script to update the changes.

(You can drag and drop each task to the editor area and use the Edit button to configure field names, variables and expressions using the Deluge Expression builder)

show:hide based on if condition

Try it out, and tell us what you think. You can always write to support@zoho.com/creator? for help.


Related Help Links:

Help Doc – Deluge Script -> Hide/Show
Help Doc – Deluge Script -> Using Script Builder

Related Forum Discussions:

http://discussions.zoho.com/zohoforums?ftid=2266000000150851
http://discussions.zoho.com/zohoforums?ftid=2266000000138102
http://discussions.zoho.com/zohoforums?ftid=2266000000018120

Comments

1 Replies to How To: Hide/Show Fields in Zoho Creator

Leave a Reply

Your email address will not be published.

The comment language code.
By submitting this form, you agree to the processing of personal data according to our Privacy Policy.

Related Posts