Hide and Show

Hide and Show

Table of Contents

Overview

The deluge Hide/Show keyword is used in On user input field action script and On load form action script to hide/show a form field. Introducing a script to hide a field disallows that field from being visible to the shared users as well as the owner or administrator of the application. The Show keyword enables you to make the hidden field visible in the form.

Note:

Syntax

hide <field name>;
show <field name>;

Examples

  1. The following code added to the On Load block of the Form will hide the fields named Activity2 and Activity3 when the form is loaded.

    hide Activity2;
    hide Activity3;
  2. The following code is added to the On User Input block of the field named activities and will be executed when thisfield value is changed. The fields that were previously hidden during form load will be displayed based on the value entered in this field.
    if (activities >= 2)
    {
    show Activity2;
    }
    else
    {
    hide Activity2;
    }
    if (activities >= 3)
    {
    show Activity3;
    }
  3. The following sample code is added to the On User input block of the Medical_Profession field. It will display the field named Medical_Profession_Type only when the Medical Professional checkbox field is selected.
    if (input.Medical_Profession)
    {
    show Medical_Profession_Type;
    }
    else
    {
    hide Medical_Profession_Type;
    }
  4. The following script is added to the On Load block of a Form. The script will be executed when the Form is loaded to add a record. It will hide the form fields when the form loads after 01-Jan-2007 and will display the message “Registration is CLOSED!”
    if (zoho.currenttime > ‘01-Jan-2007 00:00:00?)
    {
    hide name;
    hide emailid;
    hide blog_url;
    hide about_yourself;
    hide emailiderror;
    set showmessage = “Registration is CLOSED!”;
    }
  5. The following On load script will restrict access to all your shared users to edit only specific fields in your form. The script will be executed when a form is loaded for editing. The "If" statements will be executed if the login user is not the admin user.
    on edit
    {
    on load
    {
    if (zoho.loginuser != zoho.adminuser)
    {
    hide Company;
    hide First_Name;
    hide Last_Name;
    hide Cell_Phone_Number;
    hide Email_Address;
    }
    }
    }
  6. The sample code given below will hide the field named “Name” if the currenttime is past 5.00 pm
    hr =zoho.currenttime.toString(“HH”).toLong();
    min =zoho.currenttime.toString(“mm”).toLong();
    sec = zoho.currenttime.toString(“ss”).toLong();
    If ( hr >= 17 &&min >0 &&sec >0)
    {
    hide input.Name;
    }

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com