When-Validate-Item trigger in ADF with PPR

Here's a common thing that many Forms developers who move to ADF run into - you have a field that is a code and you want to display the translation of the code in the field next to it when the code is entered. In forms you use the when-validate-item trigger to do this usually.

Well in ADF one way to do it is to define a view object that is based on the Entity object of both the core and code tables. For example a VO that is based on Employees as the updateable EO and on Departments as a reference EO that is used to translate the deptId in the Employee table.
Once you did this - you want to add the ability in your JSF ADF page to populate the description field with the department name once someone fills out the departmentId.

Here is a quick demo of how you would do this - it's a very basic partial page rendering technique:

[update 2013 - there is an even simpler way to do PPR see here.]

If you are reading this blog there is a good chance that you might be interested to learn about the LOV feature of ADF - might make for a better UI. See these entries: cascading LOVs,LOVs for parameters, and part two of the above solution where you can type the description and get the code.

Comments:

Very Nice demo and all the instruction expalined very well. Thanks Sr

Posted by Shriram on January 31, 2009 at 07:27 AM PST #

Hi Shay,

Do you still have the demo url for this blog please?

Thanks

Posted by guest on August 22, 2011 at 06:17 AM PDT #

guest - thanks for reminding me - I re-recorded the demo and now you have a new version.

Posted by Shay on August 22, 2011 at 06:47 AM PDT #

Thanks Shay.

In the above demo can you make the dept name as the enterable one and to populate the deptid on employee table based on that please? The issue is the dept name cannot be enterable one. That will be useful if you could show how?

Posted by guest on August 22, 2011 at 01:12 PM PDT #

guest - for the reverse work where you enter the name instead of the code see this entry: http://blogs.oracle.com/shay/entry/finding_a_code_by_typing

Posted by Shay on August 25, 2011 at 05:48 AM PDT #

Hi Shey,
Thanks for sharing all these nice tips.

I’ve seen another way to achieve the same thing in an ADF Insider Video (LOV Switcher), Where F.Nimphius used a Groovy expression and a custom method in the “ViewObjectImpl” class
http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/ADF_Insider_Essentials/lov-switcher/lov-switcher.html
Something like “adf.source.getApplicationModule().findViewObject("DepartmentsView").getDepartmentName(DepartmentId)”

Grant Ronald wrote another way to achieve this using Groovy
http://blogs.oracle.com/grantronald/entry/using_groovy_to_read_values
Something like
“DeptView.findByKey(key(DepartmentId),1)[0].DepartmentName”

I just want to know what is the best solution and why ?

Thanks for your help.

Posted by guest on August 25, 2011 at 04:24 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

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