You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by senore100 <se...@yahoo.com> on 2010/04/26 23:21:26 UTC

autoSubmit not working when the "blank" option is selected in tr:selectOneChoice

I believe this is the default or expected behavior.
<code>
<tr:selectOneChoice id="country" value="#{actionHandler.country}" label="Country"
        autoSubmit="true" immediate="true" 
        validator="#{actionHandler.validateCountry}">
        <f:selectItems value="#{actionHandler.countryOptions}"/>
</tr:selectOneChoice> 
</code>
In the dropdown, the first option is a blank option. When I select this option, the validator method "validateCountry" is not getting called. 
I would like to change its behavior so that even when I select the blank option, the autoSubmit still submits the value (even if it submits NULL or an empty String -- I don't care). Is there a way to do this?
Many thanks!



      

Re: autoSubmit not working when the "blank" option is selected in tr:selectOneChoice

Posted by schneidc <si...@gmx.de>.
On construction of countryOptions add a "new SelectItem(null, "")" and set
country to "" by default. Then the blank is actually bound to a SelectItem
and valueChange will fire.



senore100 wrote:
> 
> I believe this is the default or expected behavior.
> <code>
> <tr:selectOneChoice id="country" value="#{actionHandler.country}"
> label="Country"
>         autoSubmit="true" immediate="true" 
>         validator="#{actionHandler.validateCountry}">
>         <f:selectItems value="#{actionHandler.countryOptions}"/>
> </tr:selectOneChoice> 
> </code>
> In the dropdown, the first option is a blank option. When I select this
> option, the validator method "validateCountry" is not getting called. 
> I would like to change its behavior so that even when I select the blank
> option, the autoSubmit still submits the value (even if it submits NULL or
> an empty String -- I don't care). Is there a way to do this?
> Many thanks!
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/autoSubmit-not-working-when-the-%22blank%22-option-is-selected-in-tr%3AselectOneChoice-tp28370398p28512393.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.