1 2 Previous Next 16 Replies Latest reply on Mar 12, 2008 1:13 PM by richfaceslearner

    Calendar "focus"

    marx3

      When I place "focus=..." on calendar it works except when I want to move focus to another calendar object. Is it a bug or should I place calendar-id in some other way?

        • 1. Re: Calendar
          tjakopec

           

          <h:form name="forma">
          <r:calendar id="datumVazenja" />
          </h:form>


          over javascript
          document.getElemetById('forma:datumVazenjaInputDate').focus;

          • 2. Re: Calendar
            marx3

            on which event?

            • 3. Re: Calendar
              marx3

              I see it as a bug. Can I open bug in JIRA?

              • 4. Re: Calendar
                ilya_shaikovsky

                you can't focus calendar component itself. use suggestion above. Focus the input of the calendar.

                • 5. Re: Calendar
                  marx3

                  I've tried many diferent method, but no luck.
                  My calendar has

                  id="dummy"
                  

                  I've tried to make
                  focus="dummyInputDate"
                  

                  but it doesn't work.

                  • 6. Re: Calendar
                    ilya_shaikovsky

                    include naming container to the id of the calendar like "form:dummyInputDate"

                    • 7. Re: Calendar
                      marx3

                      it doesn't work. Here is my code:

                      <h:form id=form>
                      (...)
                      <rich:calendar id="dummy1" tabindex="2" value="#{managerBean.dummy1}" datePattern="yyyy-MM-dd" enableManualInput="true" required="false" inputClass="f_input requiredInput" immediate="true" focus="form:dummy2InputDate">
                       <f:convertDateTime pattern="yyyy-MM-dd" timeZone="CET"/>
                       <a:support event="oninputchange" reRender="dummy1" ajaxSingle="true"/>
                      </rich:calendar>
                      <rich:calendar id="dummy2" tabindex="3" value="#{managerBean.dummy2}" datePattern="yyyy-MM-dd" enableManualInput="true" required="false" inputClass="f_input">
                       <f:convertDateTime pattern="yyyy-MM-dd" timeZone="CET"/>
                       <a:support event="oninputchange" reRender="dummy2" ajaxSingle="true"/>
                      </rich:calendar>
                      (...)
                      </h:form>
                      


                      Additionally, if I don't use converter nor ajax, "focus=" never works, and TAB from calendar always focuses on image opening calendar (which has no sense because there is no possibility to launch calendar form keyboard)

                      • 8. Re: Calendar
                        ilya_shaikovsky

                        You shouldn't use focus attribute on the calendar.

                        To change focus after the request - you should use corresponding a:support attribute.

                        • 9. Re: Calendar
                          marx3

                          but "focus" works ok except moving focus to another calendar field! So what's "focus" for?
                          And how to change focus in a:support? in oncomplete event?

                          • 10. Re: Calendar
                            marx3

                            ok, i've used "focus" attribute in a:support (not in calendar) and it works

                            • 11. Re: Calendar
                              marx3

                              ok, i've used "focus" attribute in a:support (not in calendar) and it works

                              • 12. Re: Calendar
                                richfaceslearner

                                <a4j:support focus is not working for me.This is my code.

                                <h:form id="soForm">
                                <rich:calendar id="closedDateTo" datePattern="MM/dd/yyyy" inputSize="9" enableManualInput="true">
                                <a4j:support focus="soForm:addDateToInputDate"></a4j:support>
                                </rich:calendar>
                                <rich:calendar id="addDateTo" datePattern="MM/dd/yyyy" inputSize="9" enableManualInput="true"/>
                                </h:form>

                                Please help.

                                Thanks.

                                • 13. Re: Calendar

                                  focus is set after the ajax request is done by particular event. As far, as you have no event attribute, this code will never be invoked.

                                  • 14. Re: Calendar
                                    richfaceslearner

                                    I tried with 'onblur','oninputchange',events but no luck.I want to go to 'AddDateTo' field thru tab change.Please help.

                                    1 2 Previous Next