As for the x:inputDate, it should be solved in version that should be released in a few days.
For the checkbox, I just committed a fix that I hope will work.
Looking at the HtmlCheckBoxRendererBase, I think we have a similar issue for renderCheckboxList (HtmlCheckBoxRendererBase, line 139).
If somebody can check this please.
Thanks,
Sylvain.
P.S. I attached bellow a previous email I wrote with the explanation of similar bugs.
On Wed, 2005-01-05 at 23:02 +0100, Alessandro Polverini wrote:
Hello, I'm reposting this to -dev because I got no feedback at all on -user. I just want someone to confirm the problem so that I can open a bug report on Jira if it's correct to do so. I'm experimenting a little with tab panels but I've some problems and I can't understand if I'm doing something wrong or the implementation of tab panels is buggy. The only values saved between tab switches are the ones inside inputTexts, the other components (in this example a checkbox and a date). To test the wrong behaviour is simple: check the checkBox and select a date, then switch to tab2, and then on tab1 again: everything is reset to default. Also, it can be noted the bug of the popup calendar: the popup opened is wrong if the year field is empty, but I've opened a bug report for that at http://issues.apache.org/jira/browse/MYFACES-73 . This is the JSP code I'm using: <[EMAIL PROTECTED] contentType="text/html"%> <[EMAIL PROTECTED] pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%> <html> <body> <f:view> <x:panelTabbedPane bgcolor="#FFFFCC" > <x:panelTab id="tab1" label="Tab1" > <h:outputLabel for="" value="Bool1"/> <h:selectBooleanCheckbox id="bool1" value="#{myMap.bool1}" /> <h:outputText value="Date1"/> <x:inputDate id="date1" value="#{myMap.date1}" popupCalendar="true"/> <h:message for=""> </x:panelTab> <x:panelTab id="tab2" label="Tab2" > <h:outputText value="Date2"/> <x:inputDate id="date2" value="#{myMap.date2}" popupCalendar="true"/> <h:message for=""> </x:panelTab> </x:panelTabbedPane> </f:view> </body> </html> and this is the managed bean declaration: <managed-bean> <managed-bean-name>myMap</managed-bean-name> <managed-bean-class>java.utils.HashMap</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> Thanks for any help, Alex
-------- Forwarded Message --------
From: Sylvain Vieujot <[EMAIL PROTECTED]>
To: MyFaces Development <[email protected]>
Subject: Commun error on restoring submitted values
Date: Thu, 09 Dec 2004 01:09:41 -0400
While playing with the htmlEditor component, I found that if a page is only refreshed (like when you click on a tab of an x:panelTab), then the submitted value was lost, and replaced with the component's backing bean value.
The reason, for that is that I was using a code like this in the renderer :
String textToRender = uiComponent.getValue();
Doing this, the textToRender is always the same until the form is validated, and the Update Model Values phase is run. And any intermediary rendering will just reset the data entered by the user.
A better code would be :
String textToRender = uiComponent.getSubmittedValue()!=null ? uiComponent.getSubmittedValue() : uiComponent.getValue();
For a really correct code, look at the following helper function in :
org.apache.myfaces.renderkit.RendererUtils.getStringValue
I'm sending this email to the mailing list because it is quite easy to fall for this bug, and I think I've already found 2 places in the extensions renderers where we have this bug : in the calendar renderer, and in the date renderer.
I've marked the places in the sources where I think is the bug, but we might find other occurrences.
Sylvain.
