-
1. Re: Calendar changes the empty input to previous value
ilya_shaikovsky Oct 2, 2008 6:04 AM (in response to igor_d)yes. It's about this bug. should works in 3.2.2 GA
-
2. Re: Calendar changes the empty input to previous value
igor_d Oct 2, 2008 7:43 PM (in response to igor_d)Hi Ilya,
that's what we use - 3.2.2.GA and it does not work there :-(
thanks,
Igor -
3. Re: Calendar changes the empty input to previous value
igor_d Oct 6, 2008 7:36 PM (in response to igor_d)Is there any chance if someone from Richfaces great team could look at that issue for me?
I mean, help with a workaround or create and fix the issue? -
4. Re: Calendar changes the empty input to previous value
igor_d Nov 25, 2008 12:32 AM (in response to igor_d)Hi,
I need a respone on that issue.
I would appreciate it if someone could have a look at this issue for me.
Thanks,
Igor -
5. Re: Calendar changes the empty input to previous value
ilya_shaikovsky Nov 25, 2008 5:45 AM (in response to igor_d)please reopen the bug with your page code in comment and presice steps to reproduce.
-
6. Re: Calendar changes the empty input to previous value
igor_d Nov 25, 2008 9:29 PM (in response to igor_d)Thanks, Ilya
I'm not sure if this is a bug, so I don't know if I should re-open the JIRA issue. But, here is my code.
mypage.xhtml:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ <!ENTITY nbsp "Â "> ]> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jstl/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ao="http://austrac.gov.au/ao" xmlns:rich="http://richfaces.org/rich"> <body> <h:form> <rich:calendar id="selectedDate" datePattern="dd MMM yyyy" value="#{calendarBean.selectedDate}" enableManualInput="true" popup="true"> <a4j:support ajaxSingle="true" event="oninputchange" reRender="selectedDate" bypassUpdates="true" /> <a4j:support ajaxSingle="true" event="onchange" reRender="selectedDate" bypassUpdates="true" /> </rich:calendar> <h:commandButton /> <rich:messages /> </h:form> </body> </html>
CalendarBean.java:import java.util.Date; import org.jboss.seam.annotations.Name; @Name("calendarBean") public class CalendarBean { private Date selectedDate = new Date(); public Date getSelectedDate() { return selectedDate; } public void setSelectedDate(Date selectedDate) { this.selectedDate = selectedDate; } }
Steps to reproduce:
You have a pre-populated date in the calendar input. Try to clear the input field, then exit (press tab), the previous value will come back.
I know, there is a button "clean" in the calendar popup, but not every user knows that.
Why we need to re-render on change - we wanted to instantly validate the user's input. If you remove <a4j:support> tags - the problem is gone.
My best regards,
Igor -
7. Re: Calendar changes the empty input to previous value
igor_d Nov 25, 2008 9:48 PM (in response to igor_d)Sorry, correction:
the second "a4j:support" in mypage.xhtml should have event="onchanged", then it re-renders the calendar and puts the original value back. In this case even the button "clean" in popup does not clean the input field.
Thanks,
Igor -
8. Re: Calendar changes the empty input to previous value
igor_d Dec 7, 2008 5:33 PM (in response to igor_d)we used a workarond: have a dateconverter which returns some fake date (not null) for empty string (we use new GregorianCalendar(0,0,0,0,0) and then use it in our validator and model update function to convert this date to null.
thanks,
Igor