Hello Carl,
You need to add a valueChangeListener as well and have it call
FacesContext.getCurrentInstance().renderResponse() after setting the new
Locale on the view root. So you need to add the following method to your
bean:
public void changeLanguage(ValueChangeEvent ev)
{
FacesContext context = FacesContext.getCurrentInstance();
Locale selectedLocale = (Locale)ev.getNewValue();
if (selectedLocale != null)
{
context.getViewRoot().setLocale(selectedLocale);
}
context.renderResponse();
}
And in the page:
<t:selectOneMenu value="#{viewRoot.locale}"
valueChangeListener="#{sessionBean.changeLanguage}"
immediate="true"
onchange="submit();">
<f:selectItems value="#{sessionBean.supportedLocales}"/>
</t:selectOneMenu>
Regards,
~ Simon
On 8/14/07, CarlHowarth <[EMAIL PROTECTED]> wrote:
>
>
> Hello there,
>
> I have a select one menu in a file that is included on all pages of my
> webapp. This is to change the language of the site based on user's
> preference. I have included onchange="submit();" and immediate="true"
> however the immediate property appears to be ignored and validation occurs
> on, for example, a data-entry screen.
>
> Here's my JSF:
> <t:selectOneMenu value="#{sessionBean.preferredLocale}"
> immediate="true" onchange="submit();">
> <f:selectItems value="#{sessionBean.supportedLocales}"/>
> </t:selectOneMenu>
>
> Does anybody know a workaround for this please?
>
> Thanks, Carl
> --
> View this message in context:
> http://www.nabble.com/Immediate-property-on-self-submitting-drop-down-tf4267687.html#a12145684
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>