You know sometimes its a challenge to get correct behavior for ADF editable table - meaning, to have it as much as possible aligned with smooth user experiences. One of the challenges to control when validation rules are fired - often validation is fired too early or too often (same validation error messages are repeated multiple times). In some cases this can be resolved by setting Change Event Policy = None on iterator (default is Auto PPR), but still this doesn't cover all scenarios. There is special case when ADF editable table is set to support multi-selection. With multi-selection enabled, even setting Change Event Policy to None doesn't help - validation is still fired too early. But there is solution - set Immediate property to True for ADF editable table component - this will allow to skip annoying validation messages when editing data. Validation failure messages will show up on transaction commit - invalid fields will be highlighted in red.
Download test case application, where Immediate property is set to True - AutoPPRApp.zip.
Sample application is tested firstly with default settings for ADF editable table component and multi-selection feature enabled. User creates new row:
As soon as new row is inserted, all values are blank and user needs to type something. User moves mouse cursos to any of the fields from new row - immediately validation fires without reason for empty required fields (this is way too early - user was about to type something, ADF throws validation error in advance):
Switch validation control for editable ADF table by setting Immediate = True:
New row creation behavior is different now - blank row is inserted, and user can start typing data without getting annoying validation error failure message:
Validation is invoked later, when transaction is about to be completed - validation failures are highlighted for each of the attributes:
Download test case application, where Immediate property is set to True - AutoPPRApp.zip.
Sample application is tested firstly with default settings for ADF editable table component and multi-selection feature enabled. User creates new row:
As soon as new row is inserted, all values are blank and user needs to type something. User moves mouse cursos to any of the fields from new row - immediately validation fires without reason for empty required fields (this is way too early - user was about to type something, ADF throws validation error in advance):
Switch validation control for editable ADF table by setting Immediate = True:
New row creation behavior is different now - blank row is inserted, and user can start typing data without getting annoying validation error failure message:
Validation is invoked later, when transaction is about to be completed - validation failures are highlighted for each of the attributes:
7 comments:
Hi Andrejus, may be my question is not exactly related to this POST but related to entity validation.
I am using JDeveloper 11.1..2.2.0.
I have created a Entity level validation for character length and I have specified which attribute changes should trigger this validation. Expected Logic is 'Comments' should have more than 1 characters if below mentioned attributes are changed.
e.g. When I changed just comments field with only 1 character in it, page displayed error message.
But when I changed Close Date value and didn't enter any comments then validation was not triggered and page is not showing any error.
I am expecting the validation to be triggered and error message to be displayed.
Am I missing something?
I am new to ADF 11g and as well to forum. Let me know if I should provide more information.
Below is the XML piece from Entity XML data.
Hi Andrejus,
Does this feature work only in 11.1.2 release of jdeveloper? I am using 11.1.1.6 version of jdeveloper and i still get the same validation errors even after setting the table immediate attribute to true
Thanks,
Bala
Hi,
I have tested it only with 11.1.2
Andrejus
Hi Andrijus,
I am facing an issue in which when the data is displayed in my af:table and i click on any row then the table gets stretched on full screen and my query panel gets hidden. please suggest some solution for the same.
Hard to say, it might be your ADF UI is implemented incorrectly. Do you have sample app?
Andrejus
Hi Andrejus,
I have implemented your approach and it is working. However, when I insert a new row to the table, enter the value in the new row, then select a different row. Now, if I try click the + icon to add another row, it will throw the required message. The reason is the previous created row is not being posted to the backend because the table has immediate set to true. Any suggestion on how to resolve this issue? Thanks.
Hi,
This works well with ADF 11g R2, this sample was created with ADF 11g R2.
Which ADF version you are using?
Andrejus
Post a Comment