Creator Help

Hide and Show

Overview

The deluge Hide keyword is used in On user input field action script and On load form action script to hide a form field, 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 keyword is used to display a field that was previously hidden.

Syntax

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

Using Script Builder

To add the Hide/Show task in Script Builder,

  1. Invoke the Script Builder and select the required Form/Field action.
  2. Drag-n-drop the Hide/Show task from the left-side task tree.
  3. In the Hide/Show dialog, select the function "Hide" to hide a field or "Show" to show a field which is already hidden.
  4. Select the required field from the "Select Field Name" list-box.
  5. Click Done to add the script.

Refer the topic Using Script Builder for detailed steps to invoke the script builder and add the script.

Examples

  1. The following code added to the On Add - 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 this field 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 blockof the Medical_Profession field. It will display the field named "Medical_Profession_Type" only when the 'Medical Professional' checkbox field is checked. 


    if (input.Medical_Profession)
    {
    show Medical_Profession_Type;
    }
    else
    {
    hide Medical_Profession_Type;
    }

  4. The following script is added to the Form Actions - On add - 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 is loaded after 01-Jan-2007 and 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 edit ->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;
    }

Top