10 Replies Latest reply on Nov 27, 2008 5:10 AM by ronanker

    Richfaces UI calendar component

    laurentm

      Hello fellows users
      I need and advice in using richfaces calendar component.
      Suppose I want to restrain selectable dates withing a given range I'd simply have to do:

      [...]value="#{subProject.startDate}" datePattern="#{messages['DatePattern']}" preloadDateRangeBegin="#{subProject.project.startdate}" preloadDateRangeEnd="#{subProject.project.enddate}">

      Right ?

      But as i see it there is no messages prompted to the user to alert that selected date is out of range

      is there a way to notify user or I'm missing something ?

      Also I would like to raise a usability issue

      as it is now, end user can still pick a date out of range (but it is not applied which is correct)

      But the way I thought it should be is that every single date that isn't
      within the range should be disabled by that we would avoid confusing the user when he tries to set a date...

      Is my issue valid ?

      Please fell free to share ideas regarding this issue as well as my validation issue :)

      Thank you!

      Laurent

        • 1. Re: Richfaces UI calendar component
          six-p4ck

          Hello.

          same here, i d'like to restrain selectable dates (min and max...)

          • 2. Re: Richfaces UI calendar component
            ilya_shaikovsky

            Sorry But you've used wrong attributes for your case :) This preload Dates should be used in order to use data model for client side switching mode. And the meaning of them - to define region of dates and load data for this region from model to the client on rendering.

            You have two options there:
            1) Just client side solution. you could use isDayEnabled attribute. You should define some js function which will take the date as a parameter and return if the date enabled. And define function name in this attribute.

            2) you could create data model for the calendar and define disabled dates there.

            • 3. Re: Richfaces UI calendar component
              six-p4ck

              is there somewhere demo how work CalendarDataModel?

              • 4. Re: Richfaces UI calendar component
                six-p4ck

                the Organizer Creation on demo is not very simple to understand...

                Is there not any exemple more simple for just disable a few date?

                • 5. Re: Richfaces UI calendar component
                  ilya_shaikovsky

                  calendarDataModelItem has isEnabled method. which should return false for the dates which should not be enabled.

                  But in your case it seems for me that client side solution is more simple.

                  • 6. Re: Richfaces UI calendar component
                    six-p4ck

                    i don't know with method use.

                    I have 5 calendar on my page and for each i have a start date and end date in backing bean.

                    I try with attribut isDayEnabled but i can't make it work...

                    • 7. Re: Richfaces UI calendar component
                      laurentm

                       

                      "ilya_shaikovsky" wrote:
                      Sorry But you've used wrong attributes for your case :) This preload Dates should be used in order to use data model for client side switching mode. And the meaning of them - to define region of dates and load data for this region from model to the client on rendering.

                      You have two options there:
                      1) Just client side solution. you could use isDayEnabled attribute. You should define some js function which will take the date as a parameter and return if the date enabled. And define function name in this attribute.

                      2) you could create data model for the calendar and define disabled dates there.

                      do you have any example regarding client-side soltion ?
                      I doubt I can mix EL expression and js... can I ?

                      • 8. Re: Richfaces UI calendar component
                        laurentm

                        No more infos ?

                        • 9. Re: Richfaces UI calendar component
                          ronanker

                           

                          "laurentm" wrote:
                          I doubt I can mix EL expression and js... can I ?

                          you can do something like :
                          "#{handler.test1 ? 'alert(\"'+var.libelle+'\")' : 'function('+(var.test ? handler.param1 : handler.param2)+','+handler.param3+')'}"
                          for exemple...

                          • 10. Re: Richfaces UI calendar component
                            ronanker

                            or you can do something like :
                            onchanged="verifyDates(this,#{var.dateMin},#{var.dateMax})"