1 2 Previous Next 21 Replies Latest reply on Sep 28, 2007 11:50 AM by thinkblue146

    Calendar submit()

    eminil

      I have a small problem.

      I need to have two calendar fields. And field 1 needs to update the field 2 with the same value when it is changed.

      So i've made a method that will set the value in field 2, and set this method as

      valueChangeListener="#{MyBean.processValueChange}
      

      on the first calendar.

      However, this method seems to be called only when the submit is fired in the form. So i need to be able to call the "submit()" thing from the calendar when the date is called. How can I do this?
      I have tried all of these and none work...
      oninputchange="submit()"
      oncomplete="submit()"
      onchange="submit"()
      


      If i do a simple textinput i can get the submit thing to work by doing it like this:
      <h:inputText
      id="myField"
      onchange="submit()"
      valueChangeListener="#{MyBean.processValueChange}"
      value="#{MyBean.myfield}"
      required="false" />
      

      This works... but i can't understand how to get the calendar input to work the same way... anyone have any idea?

        • 1. Re: Calendar submit()
          ilya_shaikovsky

          you should use a4j:support on the first calendar. And it should be binded to ondateselect event.

          Or you may use client side solution usign calendar JS API.
          (described at demo-site in corresponding tab)

          • 2. Re: Calendar submit()
            eminil

             

            "ilya_shaikovsky" wrote:
            you should use a4j:support on the first calendar. And it should be binded to ondateselect event.

            Or you may use client side solution usign calendar JS API.
            (described at demo-site in corresponding tab)


            Hmm i tried doing (on the first calendar):
            <a4j:support event="ondateselect" action="submit()" />
            


            That makes the calendar broken though. When you try to select a date inside it nothing happens...

            • 3. Re: Calendar submit()
              ilya_shaikovsky

              Hm.. I highly recommend you to read about a4j:support usage in our guide.

              It will highly reduce questions count in future.

              • 4. Re: Calendar submit()
                eminil

                 

                "ilya_shaikovsky" wrote:
                Hm.. I highly recommend you to read about a4j:support usage in our guide.

                It will highly reduce questions count in future.


                I found nothing that explains it there. Could you please be so kind and quote it for me?

                • 5. Re: Calendar submit()
                  eminil

                  Question count might be reduced if the answers (if there are any to give) are given on the forums as well, as people use the search feature to find things that boggle them.

                  • 6. Re: Calendar submit()
                    eminil

                    Tried adding the following to first calendar:

                    <a4j:support
                    event="ondateselect"
                    oncomplete="myForm.submit()"/>
                    

                    It seems to submit the form after selecting a date in the calendar. However, no date is being changed in the first calendar. It keeps the old date...


                    • 7. Re: Calendar submit()
                      eminil

                      Nobody can give an example on how to make one calendar update another on the form?

                      • 8. Re: Calendar submit()
                        eminil

                        Ok, so it is a bug as well?

                        From the wiki:
                        RF-945 calendar. Selection doesn't applied with a4j:support inside calendar

                        • 9. Re: Calendar submit()
                          ilya_shaikovsky

                          B.t.w. I'm created a bug to allow submit calendar after the selection.. But not only before as it performed now.

                          http://jira.jboss.com/jira/browse/RF-978

                          • 10. Re: Calendar submit()
                            eminil

                            Ahh ok, so it is not possible for me to get this sort of behavior in the current version?

                            Thanks for checking into it btw.

                            • 11. Re: Calendar submit()
                              ilya_shaikovsky

                              Not possible through server side processing. But you may use get the date selected through JS event and jst copy it to the field you need.

                              • 12. Re: Calendar submit()
                                eminil

                                 

                                "ilya_shaikovsky" wrote:
                                Not possible through server side processing. But you may use get the date selected through JS event and jst copy it to the field you need.


                                Ok, but how do i trigger on the event?

                                Suppose i have a JS test method as:
                                <script>
                                 function test() {
                                 alert('testing');
                                 }
                                 </script>
                                


                                And to trigger it i just put a onchange="test()" on the components.

                                However, on the calendar component nothing seems to work...

                                Could you give an example on how to trigger a js function from a change in the calendar field?


                                • 13. Re: Calendar submit()
                                  eminil

                                  If i do ondateselect="test()" on the calendar, it calles the test() javascript but then the calendar stops working (it doesn't set the date on the input field).

                                  • 14. Re: Calendar submit()
                                    ilya_shaikovsky

                                    update the version to snapshot. This problem was solved.

                                    1 2 Previous Next