Checkboxes in ADF are initially null, where I want them to be 0

Posted by Mark Tielemans on Stack Overflow See other posts from Stack Overflow or by Mark Tielemans
Published on 2012-03-29T13:28:36Z Indexed on 2012/03/30 23:30 UTC
Read the original article Hit count: 211

Filed under:

I am using ADF in JDeveloper and don´t have any experience with either of the two. Now I´ve run into quite some trouble yet, but for this particular thing I decided to consult the wisom of stackoverflow.

The thing is, I have an edit form for an object that contains 3 checkboxes. The checked values are set to 1, unchecked to 0. In my database, the values are NOT NULL, and I want to keep it that way.

The thing is, in the edit form, if the user submits the form leaving any boxes unchecked, it will result in an error, because the unchecked box values apparently remain null. Only after checking and then unchecking the boxes again, their values will be '0' rather than null.

I've tried some things, including making the attributes mandatory in the domain BCD, but that just gives a bit more neat error message..

Any help would be greatly appreciated!!

EDIT

I made a little progress thanks to the guide provided by Joe, but still run into problems.

I changed the values that should be checkboxes in my model, making them BOOLEANs where the table columns are NUMBERs (All are also mandatory and have a default value of 0). This automatically changed the corresponding View Object too. In the Application module, this now works great. It shows checkboxes, a checked one will return 1, an untouched one will return 0.

However, I deleted the old form, and inserted a new one using the corresponding Data Control. I gave these values the checkbox type. I still had to edit the bindings (which I think reflects the problem, as this is not the case with, say, a model-level defined LOV) and gave them 1 for checked and 0 for unchecked.

However, now apart from the original problem still occurring, also the checkboxes cannot be unchecked after checking, and return 0 when checked (and null when left untouched).

Even though this has created new problems, it works correctly in my AM. Does someone know what I'm doing wrong in my Swing form?

© Stack Overflow or respective owner

Related posts about oracle-adf