Thursday Jan 23, 2014

Disbling buttons when new record is created in ADF form

In some cases, we might want to disable some of the buttons / items in the page (say navigation buttons), when a new record is created in the form. 

To achieve this, we would start from Sireesha's excellent blog : https://blogs.oracle.com/adf/entry/highlighting_new_rows_in_adf  . In this blog, insight is given on entityState of a row. 

Before starting, assuming that we have a Form (Say based on Employees), with navigation, create, commit and rollback buttons.

Our usecase is to disable the navigation buttons when the user clicks on CreateInsert button. For this, we could set an EL to the disabled property of the navigation buttons.

Code snippet of the First button.

<af:commandButton actionListener="#{bindings.First.execute}"
                                  text="First"
                                  disabled="#{bindings.Empno.currentRow.entities[0].entityState == 0 or !bindings.First.enabled}"
                                  partialSubmit="true" id="cb2"/>

Here Empno refers to the one of the attribute binding of the form (Primary Key attribute to be precise).

This approach disables the buttons when the form goes to Insert mode (refer the blog mentioned above to find out more about entityState EL).



About

Tips & Tricks from Arun on JDev ADF, Forms, SQL & PL/SQL.

Search

Archives
« January 2014
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
24
25
26
27
28
29
30
31
 
       
Today