How To Render an <af:inputText> Visible/Invisible Depending on the Value of an af:selectOneChoice

(Doc ID 369436.1)

Last updated on AUGUST 04, 2016

Applies to:

Oracle JDeveloper - Version and later
Information in this document applies to any platform.


This note explains how to render an <af:inputText> visible/invisible depending on the value of another component.
We will base our explanation on a JSP JSF page that includes 2 components <af:selectOneChoice>:

The page includes 3 <af:inputText>. The first 2 inputTexts, First Name and Last Name, should always be displayed.
The 3d inputText Maiden Name should be rendered visible only when Gender=Female AND Marital Status=Married, as shown in the following figure:

Figure 1 - Maiden Name inputText displayed.

With other values for the Gender and Marital Status, Maiden Name field should be invisible, as shown in the next figure:

Figure 2 - Maiden Name inputText not displayed.

You set the following properties to have it working:

  1. AutoSubmit=true for the 2 components selectOneChoiceGender and selectOneChoiceMaritalStatus
  2. Rendered=#{backing_demo.selectOneChoiceGender.value=="Female" && backing_demo.selectOneChoiceMaritalStatus.value=="Married"} for the inputTextMaidenName
  3. PartialTriggers=selectOneChoiceGender selectOneChoiceMaritalStatus for the inputTextMaidenName

The page source is as the following:

Running the page doesn't work as expected:
the Maiden Name field is never displayed.  


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms