ADF Dynamically Render Command button based on Dropdown list value:    1 Jan, 2009

I just want to demonstrate a simple form where there is a drop down (in JSF terminology, the drop down list is called SelectOneItem), This list contains cities, when the value of the dropdown list is '1' corresponding to the city of Nablus, we want to render a command button.

In this example, i am using Jdeveloper 10.1.3.2

 

when other value is selected the command button disappears

 

Solution

1)Create  SelectOneChoice component called chkOneChoice and set the following properties

AutoSumbit=true

Id = am

2) Create a Panel Group  and insert the command button inside the Panel Group.  Then set the Partial Triggers property of the Panel Group to am as shown below  (Partial Triggers = am)  which refers to the selectonechoice component

3) Set the Rendered property of the Command button to #{chkOneChoice.label1.value=='1'} as shown below

IMPORTANT NOTE: Failure to introduce the panelGroup as a parent for the command button will not accomplish the requirement.  This so because you cannot Partial Trigger an item which is not rendered.  In our case, if we immediately added a command button and set its partial trigger property to am and set the rendered property #{chkOneChoice.label1.value=='1'} the PPR rendering would not work, simply because the button is not rendered, and we do not want to render the button all the time, so we make the button a child of panelGroup. Make the panelgroup always rendered and make it repond to PPR

 

Ammar Sajdi

Jan 1, 2009