'Oracle ADF Validate the selected value of a inputComboboxListOfValues

I use the Oracle ADF included in JDeveloper 12c. I had to create a comboboxListofValue to select a MsterAsset, let just say it has an Id and a Number, and it's the same entity object as the one I modify.

As I understand you can't have the classic "linked to an id, but show a name" behaviour naturally, so I set the LOV on a transient attribute of my view (MasterAssetNumber)

The LOV return the number and the id, which set the MasterAssetId, the non transient attribute.

<af:inputComboboxListOfValues id="masterAssetNumberId"
  popupTitle="Search and Select: #{bindings.MasterAssetNumber.hints.label}"
  value="#{bindings.MasterAssetNumber.inputValue}"
  label="#{bindings.MasterAssetNumber.hints.label}"
  model="#{bindings.MasterAssetNumber.listOfValuesModel}"
  required="#{bindings.MasterAssetNumber.hints.mandatory}"
  columns="#{bindings.MasterAssetNumber.hints.displayWidth}"
  shortDesc="#{bindings.MasterAssetNumber.hints.tooltip}">
    <f:validator binding="#{bindings.MasterAssetNumber.validator}"/>
</af:inputComboboxListOfValues>

This work pretty well except on the validation. I have an entity attribute validation on MasterAssetId, to avoid cycling reference (master is the child of its child, etc...)

Problem is that this validation is triggered even before the MasterAssetNumber value is setted, so visually, there is no change on the screen. But when I save, I have the error message displaying.

Actually the problem is very similar to this blog entry :http://adfbugs.blogspot.ca/2009/11/attribute-validation-on-input-list-of.html But in my case, I don't have the possibility to just show the valid entries.

How can I make the error propagate to the UI while I select a value OR how to bypass the validation until the save action, for this field?

Thanks



Solution 1:[1]

Two things:

A.In your DataBindings.cpx file, add syncMode="Immediate" to your BC4JDataControl tag like below:

<BC4JDataControl id="XXXAppModuleDataControl" Package="com.xx.model.services"
                   FactoryClass="com.view.datacontrol.XXDataControlFactoryImpl" SupportsTransactions="true"
                     SupportsFindMode="true" SupportsRangesize="true" SupportsResetState="true"
                     SupportsSortCollection="true" Configuration="XXXDataAppModuleLocal" syncMode="Immediate"
                     xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>

B. Make sure your your af:inputComboboxListOfValues has autosubmit="true" attribute set.

Solution 2:[2]

Move that validation to 'Entity Level' from 'Attribute Level'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Florin Marcus
Solution 2 Ravinder Namsani