i think we can drop that NO_SELECTION_VALUE and just return "" for it in AbstractSingleSelectChoice so that it is consistent with what ChoiceRenderer does Calling choicerender directly doesn't seem to be a good choice because that is just a default implementation..
johan On 10/6/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
Hi, There is a inconsistency of how null is handled in ChoiceRenderer#getIdValue and AbstractSingleSelectChoice#getModelValue. ChoiceRenderer renders either "" as id, or index under which the null value is in choices list. AbstractSingleSelectChoice#getModelValue returns always -1 for null. The outcome is that if RadioChoice has item with null value and the model object is also null, the item is not pre-selected. (because getValue() is compared to getChoiceRenderer().getIdValue(choice, 0)) It is a bug, but I'm not sure what would be the best way to fix it. Perhaps when AbstractSingleSelectChoice#isNullValid() is true the getModelValue should call choiceRenderer.getIdValue(object, index) even for null objects? WDYT? -Matej
