3 Replies Latest reply on Oct 25, 2012 9:30 AM by sivaprasad9394

    <rich:calendar> how to show popup at certain date

    javatwo

      Hello,

       

      I like to show rich:calendar pop-up at the date defined in backing bean, not system time (new Date()).

      <rich:calendar  value=... currentDate={bean.currentDate} />

       

      I got error message:

      Property 'currentDate' not writable on type java.util.Date

       

      currentDate should be read only.

      How to position pop-up at user-defined date(not system time) ?

       

      Thanks for help.

      Dave

        • 1. Re: <rich:calendar> how to show popup at certain date
          sivaprasad9394

          Hello Dave,

           

          Try like below,

           

          <rich:calendar value="#{calendarBean.selectedDate}"

                                 locale="#{calendarBean.locale}"

                                 popup="#{calendarBean.popup}" readonly="true"

                                 datePattern="#{calendarBean.pattern}"                     

                                 cellWidth="24px" cellHeight="22px" style="width:200px"/>

           

           

          I have created calenderBean.java file,

           

          public CalendarBean() {

           

                  locale = Locale.US;

                  popup = true;

                  pattern = "MMM d, yyyy";

                  jointPoint = "bottomleft";

                  direction = "bottomright";

                  readonly = true;

                  enableManualInput=false;

                  showInput=true;

                  boundary = "inactive";

              }

           

          _________________________________________________

           

          public Date getSelectedDate() {   

                       String dateString = "09/03/2012";
                       Date convertedDate = null;
                       SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
                       try {
                           convertedDate = dateFormat.parse(dateString);
                           selectedDate = convertedDate;
                      } catch (ParseException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                      
              return selectedDate;

          }

           

           

           

          1.JPG

           

           

           

           

          Thanks,

          Siva

          • 2. Re: <rich:calendar> how to show popup at certain date
            javatwo

            Hi Siva, Thanks for sharing.

            I noticed in your example that the value is bound to calendarBean.selectedValue that is initialized to a date.

            In my case, the value is null and user is required to input a date. In our application, there is a clock different from

            system clock. we want to <rich:calendar> to use our own clock.

             

            Thanks.

            • 3. Re: <rich:calendar> how to show popup at certain date
              sivaprasad9394

              Hi Dave,

               

              Please refer this link,it will help you..

               

              https://community.jboss.org/thread/150860

              https://community.jboss.org/thread/9305

               

              Regarding error,

              Property 'currentDate' not writable on type java.util.Date,

               

              http://stackoverflow.com/questions/5832026/jsf-webflow-hselectmanylistbox-converting-troubles

               

              Thanks,

              Siva