You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Arnaud MERGEY <am...@sunopsis.com> on 2006/06/20 10:08:26 UTC

af:selectBooleanCheckbox converter problem

Hi,

Why converter method  getAsString is not called in selectBooleanCheckBox 
component ?

In my page with this tag

<af:selectBooleanCheckbox label="test boolean"
                        value="#{test.boolean}"
                        converter="#{test.booleanConverter}"/>

I have a String representation of boolean in my bean (getBoolean return 
"0" if false end "1" if true)
My converter convert in getAsString "0" into "false" and "1" into "true" 
and vice versa (getAsObject).

Checkbox is never checked when getBoolean return "1", so I have debugged 
my application and I can see than getASString is never called.
getAsObject is called normally when my form is submitted.

How can I configure selectBooleanCheckBox to call converter getAsString ?

thanks for help
Arnaud

Re: af:selectBooleanCheckbox converter problem

Posted by Arnaud MERGEY <am...@sunopsis.com>.
Hi,

I have checked in source code

If I use
<af:inputText label="test boolean in textfield"
                       value="#{test.boolean}"
                       converter="#{test.booleanConverter}"/>

Converter getAsString is called inside SimpleInputTextRenderer 
encodeAllAsElement method with addOnSubmitConverterValidators calling.

If I use
<af:selectBooleanCheckbox label="test boolean checkbox"
                       value="#{test.boolean}"
                       converter="#{test.booleanConverter}"/>

In SimpleSelectBooleanRenderer encodeAllAsElement doesn't call 
addOnSubmitConverterValidators so I think it is why getAsString method 
of my converter isn't called.

Is it normal issue ?, is it bug ?

Thanks for help,
Arnaud

Arnaud MERGEY a écrit :
> Hi,
>
> Why converter method  getAsString is not called in 
> selectBooleanCheckBox component ?
>
> In my page with this tag
>
> <af:selectBooleanCheckbox label="test boolean"
>                        value="#{test.boolean}"
>                        converter="#{test.booleanConverter}"/>
>
> I have a String representation of boolean in my bean (getBoolean 
> return "0" if false end "1" if true)
> My converter convert in getAsString "0" into "false" and "1" into 
> "true" and vice versa (getAsObject).
>
> Checkbox is never checked when getBoolean return "1", so I have 
> debugged my application and I can see than getASString is never called.
> getAsObject is called normally when my form is submitted.
>
> How can I configure selectBooleanCheckBox to call converter getAsString ?
>
> thanks for help
> Arnaud
>