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

Examples

1. In the following sample code, the unwanted Activity fields are hidden during form load, so that the form will be initially shown with only the Activity1 field.

  
    Activity1
    (
        type  =  picklist
        values  =  {"action1",   "action2"}
    )

    Activity2
    (
        type  =  picklist
        values  =  {"action3",   "action4"}
    )

    Activity3
    (
        type  =  picklist
        values  =  {"action5",   "action6"}
    )
    on load
    {
       hide Activity2;
hide Activity3; }

2. In the following code, the on user input form action is executed when the No_of_Activities field value is changed. The fields that were previously hidden during form load, will be displayed based on the value entered in this field.

 

		
    No_of_Activities
    (
        displayname  =  "No of Activities"
        type  =  picklist
        values  =  {"1",   "2",   "3",   "4"}
	      on user input
        {
            activitiesno = input.No_of_Activities.toLong();
            if (activitiesno  >=  2)
            {
                show Activity2;
            }
            else
            {
                hide Activity2;
            }
            if (activitiesno  >=  3)
            {
                show Activity3;
            }
        }

3. The following sample code will by default hide the 'Medical Professional Type' field when the form is loaded and will show the field only when the 'Medical Professional' box is checked.

Medical_Profession
    (
        displayname  =  "Medical Profession"
        type  =  checkbox
        defaultvalue  =  false
        on user input
        {
            if (input.Medical_Profession)
            {
                show Medical_Profession_Type1;
            }
            else
            {
                hide Medical_Profession_Type1;
            }
        }
    )

    Medical_Profession_Type1
    (
        displayname  =  "Medical Profession Type"
        type  =  picklist
        values  =  {"A",   "B",   "C",   "D"}
    )
        on load
{
hide Medical_Profession_Type1;
}

4. The following sample code will hide the form fields when the form is loaded after a specific date.

on load
{
    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!”;
    }
}

Related Links

Tips & Tricks -> Hide/Show Fields