ADF-Jdeveloper How to set the first value by default of a RichSelectOneChoice?

2.5k Views Asked by At

I have a RichSelectOneChoice that is populated from a LOV, the default value is null, I know that it is a bad practice to leave default values in a SelectOneChoice but the user requires it. Thanks in advance.

2

There are 2 best solutions below

0
On BEST ANSWER

I know is a bad practice set default values in comboboxes,

In my solution I set the default value in the current row of my viewModel of the field that I want to be selected by default in my select on choice, before to go to that page.

It´s something like this:

rowViewObjectRow.setCodeFieldReferenceSelectOneChoice(0);

The value "0" always be in the lov, is a bad practice, and if you find another solution without set the value by default could be better.

1
On

The RichSelectOneChoice has an attribute called value, setting that value will set the default value. Selection comes from af:selectItems or other selectItem(s) alternatives, so there are no contradictions there!