Hiding Form Items

You can use Form class methods to change the value of the hidden property of form items, hiding parts of the form from the user.

Interactive instructions such as INPUT or CONSTRUCT will automatically ignore a formfield that is hidden. The value can be:

By default, all form items are visible.

Call the methods using the reference to the form object. Provide the name of the form item to the method and set the value for hidden.

Genero adjusts the display of the form to eliminate blank spaces caused by hiding items, where possible.

Example 3

01 SCHEMA custdemo 
02 MAIN
03  DEFINE win ui.Window,
04         fm ui.Form,
05         mycust record like customer.*
06  CONNECT TO "custdemo"
07  OPEN WINDOW w1 WITH FORM "hidecust"
08  SELECT * INTO mycust.* FROM customer 
09      WHERE store_num = 101
10  DISPLAY BY NAME mycust.*
11  LET win = ui.Window.getCurrent()
12 LET fm = win.getForm()
13  MENU
14   ON ACTION hide 
15     CALL fm.setFieldHidden("contact_name",1)
16     CALL fm.setFieldHidden("addr2", 1)
17     -- hide the label for contact name 
18     CALL fm.setElementHidden("lbl", 1)
19   ON ACTION quit 
20     EXIT MENU
21  END MENU
22 END MAIN
This figure is a screenshot showing the form before hiding formfields with ui.Form.setFieldHidden().

Figure 1. Form before hiding element

This figure is a screenshot showing the form after hiding formfields with ui.Form.setFieldHidden().

Figure 2. Form after hiding element