9 Replies Latest reply on Jun 2, 2008 12:25 PM by pmuir

    rich:calendar Not Updating Seam-Managed Component

    darthmaul

      I am using <rich:calendar> in my Seam app, and it is bound to a property of a Seam-managed component.  It retrieves the value just fine.  However, when I submit the page to move to the next page in the flow, I find in my logs that the setter is never called.  Thus, the property value remains unchanged regardless of what the user selected.


      Here are the variations I have tried:


      <rich:calendar value="#{order.shipmentDate}"
                     popup="true"
                     datePattern="#{propertyManager.dateFormat}"
                     showFooter="false"
                     inputStyle="width:75px;"
      converter="org.jboss.seam.ui.DateTimeConverter"
                     id="dateCalendar"/>
      



      <rich:calendar value="#{order.shipmentDate}"
                     popup="true"
                     datePattern="#{propertyManager.dateFormat}"
                     showFooter="false"
                     inputStyle="width:75px;"    
                     id="dateCalendar"/>
         <f:convertDateTime />
      </rich:calendar>
      



      <rich:calendar value="#{order.shipmentDate}"
                     popup="true"
                     datePattern="#{propertyManager.dateFormat}"
                     showFooter="false"
                     inputStyle="width:75px;"    
                     id="dateCalendar"/>
         <s:convertDateTime />
      </rich:calendar>
      



      None of these actually update my Seam-managed component to the value selected from the calendar by the user.


      Any insight into why this is and what I need to do is appreciated.


      Thanks.

        • 1. Re: rich:calendar Not Updating Seam-Managed Component
          tom_goring

          Works for me:




          <rich:calendar
               id="taxPointDatePicker"
               value="#{credit.taxPointDate}"
               popup="true"
               datePattern="dd/MM/yyyy"
               enableManualInput="true"
               required="true"
               disabled="#{!contractorSaleEditor.editMode}"
               inputClass="#{contractorSaleEditor.editMode?'':'disabled'}"
               ajaxSingle="true"
               eventsQueue="jnetAjax" 
               ignoreDupResponses="true"
          />


          • 2. Re: rich:calendar Not Updating Seam-Managed Component
            darthmaul

            Unfortunately, your approach didn't work for me.  Here is what I have now:



            <rich:calendar             value="#{order.desiredShipmentDate}"
                                       popup="true"
                                       datePattern="#{propertyManager.dateFormat}"
                                       showFooter="false"
                                       inputStyle="width:75px;"
                                       ajaxSingle="true"
                                       eventsQueue="eventsQueue"
                                       ignoreDupResponses="true"
                                       id="orderDateCalendar"/>
            



            No converters.  Pretty much identical to yours.


            Which leads me to wonder what else might be at issue.  What is the datatype of your credit.taxPointDate?  My order.desiredShipmentDate is an instance of java.util.Date


            Any other thoughts on what the issue might be?


            Thanks.

            • 3. Re: rich:calendar Not Updating Seam-Managed Component
              infinity2heaven

              Sounds trivial but have you first verified what is the value sent by the corresponding request params? (Is it being submitted from a correct form?).

              • 4. Re: rich:calendar Not Updating Seam-Managed Component
                darthmaul

                There is nothing wrong with trivial since what I am trying to accomplish is about as trivial as it gets--updating an item on the server side.  I have indeed confirmed that everything is enclosed in an <a4j:form> tag.


                However, I have found something interesting.  I have a radio button group on the same page, and that too isn't updating anything on the server.  Clearly, this is a bigger problem than merely rich:calendar.  This is the first time I have encountered a problem like this, so I am tinkering to try to find what makes this facelet different from the others.


                Thanks.

                • 5. Re: rich:calendar Not Updating Seam-Managed Component
                  darthmaul

                  One thing that occurred to me is the manner I leave the page.  The user selects the date from the calendar and the radio button value and then hits this button:


                  <input type="button" jsfc="s:button" id="shopButton" view="/shop.jspx" value="Go Shopping" propagation="join" />
                  



                  Is there something about this button that causes the model not to be updated on the server side?


                  Any insight is appreciated.


                  Thanks.




                  • 6. Re: rich:calendar Not Updating Seam-Managed Component
                    tom_goring

                    That does not look like a submit button to me...here is a submit button:



                    <h:commandButton action="#{bean.action}" value="Go Shopping"></h:commandButton>               



                    then you define the navigation shop.jspx in your page.xml

                    • 7. Re: rich:calendar Not Updating Seam-Managed Component
                      darthmaul

                      I guess, to paraphrase Bill Clinton, it comes down to what the definition of submit button is. 


                      It is true the button you describe is a submit button.  But in my case, I would argue that I am producing a submit button as well. 


                      Let me describe my use case.  I am basically simulating wizard-like behavior that doesn't necessarily demand an action to be performed when moving from one page to the next in the flow.  Essentially, all I want to have happen is for the various conversational components to be updated with the values provided by the user and then have the user move on to the next page.  To me, having those conversational components updated, even though no action is performed, is still submitting.


                      Well, semantics aside, it is clear that my approach isn't modifying the components in the model.  How then can I update these components and move on to subsequent pages and propagate the conversation...when there is no action that needs to be performed beyond updating the components with the values provided by the user on each page?  I suppose I could call an action method on a component that is empty, but that just smells bad.


                      Thanks.

                      • 8. Re: rich:calendar Not Updating Seam-Managed Component
                        darthmaul

                        After reviewing the documentation, I found this here regarding <s:button>:


                        A button that supports invocation of an action with control over conversation propagation. Does not submit the form.



                        Well, that answers that!


                        I guess I need to use h:commandButton in my facelet and then define the conversation propagation in pages.xml. 


                        I am curious though when this button would be useful if the page is never submitted.


                        Thanks.



                        • 9. Re: rich:calendar Not Updating Seam-Managed Component
                          pmuir

                          I am curious though when this button would be useful if the page is never submitted.

                          Navigation