Monday, February 14, 2011

Dependent LOV in table shows invalid values

Dependent LOV in table sometimes show invalid values.
This is reproduced in Jdeveloper and
For example lets say that there is a business rule that ‘The manager of an Employee must be from the same Department.’

To implement this we usually have a list of value for departments and a list of values for Managers that is depended from the department field. Also added dependency on ManagerId attribute to DepartmentId attribute.

I have created an updatable table with the above fields and added auto-submit and partial trigger properties

So for example (testTable.jspx)
When Department is Administration there are 2 selectable employees (189,200) for manager Id
When Department is Marketing there are 3 different selectable employees (190,201,202) for manager Id

It works correctly as long as there is no validation error in manager id field.

To reproduce the problem, do the following:

1. Select row for employee 190 that has department Marketing and type in ManagerId field the value 200.
2. Select an other row. A validation error shows for Manager Id.
3. Select again the same row and change Department to Administration. (Validation error continue to show)
4. open ManagerId LOV. The values shown are wrong (190,201,202). The ManagerId LOV is not refreshed according to Department.
5. Select or Type a value in field (i.e. 201 that is invalid) and press commit. The invalid value cleared. The row is saved to database with null value for manager id.

This issue does not reproduce in form layout (testForm.jspx) since Manager Lov always becomes null when department is changed.

It is quite confusing for the users.

Test Case:

Still reproduce in jdeveloper 11.1.2
The workaround we found for this is in managed bean to resetValue of the LOV component in the value change listener of choise list

No comments:

Post a Comment