Multiple a4j support tags on one richfaces (Seam 2.2) calendar component

223 Views Asked by At

I have added 2 a4j support tags to a richfaces Calendar, one with an onblur event and the other with an oninputblur event, which would allow users to either click to select a date from a Calendar, or input the date manually. There is also the chance a user could click to pick a date, and then manually edit it afterwards too. Both tags reRender the same Calendar component ID. In testing so far this is working, but I am wondering if there is any chance a servlet exception could occur where it tries to reRender "twice" on the same ID? I am thinking it wouldn't since they are each distinct events, but if anyone sees a concern with that I would sincerely appreciate the feedback. Below is the code snippet I am referring to.

<s:decorate id="acctHldrBthDtField" template="/layout/edit.xhtml">
    <ui:define name="label">Account Holder Birth Date</ui:define>
      <rich:calendar id="acctHldrBthDt"
          value="#{P18SlipHome.instance.acctHldrBthDt}"
          datePattern="dd-MMM-yyyy" enableManualInput="true" 
          onfocus="saveCurrentFocus(this);" >
          <a:support event="onblur" reRender="acctHldrBthDtField" ajaxSingle="true"/>
          <a:support event="oninputblur" reRender="acctHldrBthDtField" ajaxSingle="true"/>
     </rich:calendar><br/>Date format must be dd-Mmm-yyyy
</s:decorate>
1

There are 1 best solutions below

1
Randy On

For anyone who might be using version 2.2 of Seam Richfaces and are facing this particular issue, this is the answer I arrived at that works for me:

<s:decorate id="cntlPrsnBthDtField" template="/layout/edit.xhtml">
 <ui:define name="label">Birth Date</ui:define>
 <rich:calendar id="cntlPrsnBthDt"
    value="#{_p18CntlPrsn.bthDt}"
    datePattern="dd-MMM-yyyy" 
    enableManualInput="true"
    maxlength="11" >
    <a:support event="oninputchange" action="#{P18SlipHome.onDateChangeValidation}" reRender="cntlPrsnBthDtField" ajaxSingle="true"/>
    <a:support event="onchanged" action="#{P18SlipHome.onDateChangeValidation}" reRender="cntlPrsnBthDtPanelGrid" ajaxSingle="true"/>
 </rich:calendar><br/>Date format must be dd-Mmm-yyyy
</s:decorate>