Richfaces manual calendar entry value is optional

I have a richfaces calendar component defined as

<rich:calendar id="startDate" value="#{myBean.dateSet.startDate}" 
               timeZone="#{myBean.dateSet.timeZone}"
               datePattern="#{myBean.dateSet.datePattern}"
               enableManualInput="true" immediate="true">
      <a4j:support event="onchanged" action="#{myBean.adjustEndDate}" 
                   reRender="startDate,endDate" ajaxSingle="true" />
</rich:calendar>

when I change the date using the / gui popup, everything works fine.

However, when I change it using an input text field, the value is not updated to myBean.dateSet.startDate, although it is correctly updated by the calendar component itself (i.e. if I click on the calendar pop-up window icon it shows the updated current date).

Any suggestions on how I can get it to update myBean value correctly?

Thank!

+3
source share
3 answers

Use the oninputchange event, which tracks changes manually.

+2
source

, , , <calId>InputDate. startDateInputDate. , -!

+1

You can use the oninputchange event inside the rich: calendar component, for example Max Katz.

For instance:

<rich:calendar 
   ...
   oninputchange="invokeCalendarOnChange(event,'#{rich:clientId('$idOfTheCalendar')}')"
   ...
</rich:calendar>

function invokeCalendarOnChange(event, id) {
   var c = RichFaces.$(id);
   c.invokeEvent("change", RichFaces.getDomElement(c.id), event, c.selectedDate);
}

Hope this helps!

+1
source

Source: https://habr.com/ru/post/1750235/


All Articles