Thursday, September 6, 2012

Important Hint for ADF BC Check Box Implementation

Sometimes it can be a bit frustrating - small fix can resolve serios problem. I would like to describe example of such small fix - making check-box functionality work in ADF. This topic is related to - custom check box, based on Y/N or 0/1 values. Null value was stored for the checkbox, no matter it was checked or unchecked.

Download fixed sample application - CheckBoxSampleApp.zip. Sample is based on modified Regions table from HR schema - APPROVE column is added with Y/N values:


Initially I was facing such issue, check box value was set:


Transaction was sending NULL value for the check box field to DB:


Eventually this was resolved by spotting "Include 'No Selection' Item" was selected for the choice list defined on check box attribute. Don't ask me, why we need to define choice list for the check box field - its weird, but it works. The thing is with "Include 'No Selection' Item" selected, ADF injects blank value into check box definition and even visually it looks all correct - it fails to work from ADF UI (it works from ADF BC test utility):


Make sure to uncheck "Include 'No Selection' Item", when implementing custom check box:


Test check box implementation again:


It works now like a charm, correct value is updated in DB:


1 comment:

Pegade Shaheen said...

Dear Andrejus,
this is a very good example for check box , but i have two questions:
1- what if i have not simple look up (id and value) but a domain , id , and value for all the tables/UI that need check box (e.g. Gender - M - Male , Gender - F - Female , Approval - I - Initial ,
Approval - A - Approved)

2- can u explain further what the purpose of using the resource bundle