Enabling or disabling JSF controls

You can enable or disable JSF input controls and command buttons with EGL code. A disabled control cannot be edited or changed on the web page.

This task has the following prerequisites: For more information on these prerequisites, see Accessing the JSF component tree with the source assistant.
To enable or disable a JSF control with an EGL JSF Handler:
  1. On a blank line inside a function in the JSF Handler, press Ctrl+Shift+Z. The EGL Source Assistant window opens, displaying the JSF controls on the page.
  2. In the EGL Source Assistant window, select the JSF control that you want to access.
  3. Click OK.
    The EGL source assistant adds two lines of EGL code to the JSF Handler. The first line defines an EGL variable of the type that matches the JSF control that you selected. The second line associates that variable with the JSF control. For example, the code to access a JSF input text control might look like this:
    text1 HtmlInputText;
    text1 = myViewRoot.findComponent("form1:text1");
  4. Using the EGL variable that the source assistant created, enable or disable the JSF control with the setDisabled function. For example, to enable a text control, add this code:
    text1.setDisabled(no);
    To disable the text control, add this code:
    text1.setDisabled(yes);

Feedback