10 Replies Latest reply: Apr 18, 2012 9:43 PM by arms777 RSS

    Disabled dates in a Calendar Picker in Forms 10G

    arms777
      I am using a calendar picker for my form. After the calendar has been displayed, I noticed that whenever i select any of the four buttons ( previous month, next month, previous year or next year ), for each month in the calendar, there are several dates that are disabled, and hence cannot be selected. I tried scrolling thru each month of every year but it seems it is prevalent. The disabled dates sometimes appear in the beginning dates, like 1, 2, 3...or in the ending dates like 25, 26, 27... or in both. Even if I use the tab to scroll thru the dates, these disabled dates were skipped. This does not happen at the first display of the calendar, it is when i have scrolled thru any of the four mentioned buttons that this happens.

      Please help. Thanks.
        • 1. Re: Disabled dates in a Calendar Picker in Forms 10G
          Andreas Weiden
          I am using a calendar picker for my form
          Well, there are several calendar widgets for forms, forms-based, java-based,... . I would guess that your problem is specific to the calendar you use, so without mentioning what calendar we use, it will be hard to help you.
          • 2. Re: Disabled dates in a Calendar Picker in Forms 10G
            arms777
            I'm sorry. I am using the forms calendar that was suggested by Mr. Craig in his article [http://sites.google.com/site/craigsoraclestuff/oracle-forms---how-to-s/forms-how-to-use-a-calendar-in-a-form] , I hope you are familiar with it. Actually, I have been using it only for the past two weeks since I have just learned to use it. Mr. Craig assisted me thru it but only lately that I have realized that I have a problem with it. I hope you can help me. Thanks a lot.
            • 3. Re: Disabled dates in a Calendar Picker in Forms 10G
              Andreas Weiden
              Sorry, i'm not familiar with it. But as it is a forms-calendar, you could open the calendar.pll and have a look at the source-code.
              • 4. Re: Disabled dates in a Calendar Picker in Forms 10G
                CraigB
                I noticed that whenever i select any of the four buttons ( previous month, next month, previous year or next year ), for each month in the calendar, there are several dates that are disabled, and hence cannot be selected.
                I didn't notice this during development. I'll take a look at the supporting package and see what is wrong. It looks like a bug so when I get it fixed I will post an update to the code.

                Craig...
                • 5. Re: Disabled dates in a Calendar Picker in Forms 10G
                  arms777
                  Thank you very much Mr. Craig. I will be waiting for your update.
                  • 6. Re: Disabled dates in a Calendar Picker in Forms 10G
                    CraigB
                    Sorry, it took a day or two to get back to you. I have found the cause of the problem and will publish an update with the fix. In the mean time, you can fix your copy by editing the DATE_LOV package body and change the following lines of code in the DISPLAY_CAL procedure.
                    /* code with the error! :( */
                       -- Assign the number to the day
                       FOR i IN first_dow..loop_end LOOP
                          IF ( get_item_property('date_button'||to_char(i), displayed) = 'FALSE' ) THEN 
                             set_item_property('date_button'||to_char(i), displayed, property_true);
                          END IF;
                       ...
                    The problem is that when an Item's DISPLAY property is set to FALSE, it also sets the ENABLED property to FALSE. This has a cascade affect which also set the NAVIGABLE, UPDATE Only if NULL, and UPDATE_ALLOWED properties to FALSE as well. This appears to be an undocumented "Feature" of Forms because the Forms help system does not list this a a side-affect of setting the DISPLAYED property to FALSE. It is listed as a side-affect of setting the VISIBLE property to FALSE. Consequently, I didn't think I needed to set these properties to TRUE. Here is the corrected code.
                       -- Assign the number to the day
                       FOR i IN first_dow..loop_end LOOP
                          IF ( get_item_property('date_button'||to_char(i), displayed) = 'FALSE' ) THEN 
                             set_item_property('date_button'||to_char(i), displayed, property_true);
                    
                             IF ( get_item_property('date_button'||to_char(i),enabled) = 'FALSE' ) THEN 
                                set_item_property('date_button'||to_char(i),enabled, property_true);
                                set_item_property('date_button'||to_char(i),navigable, property_true);
                             END IF;
                       END IF;
                    I've using this calendar quite a bit over the years and this is the first time this was discovered; so thanks for finding it and reporting it! :D

                    Craig...
                    • 7. Re: Disabled dates in a Calendar Picker in Forms 10G
                      arms777
                      Thank you very much Mr. Craig for your help. 'Til next time and God bless you.
                      • 8. Re: Disabled dates in a Calendar Picker in Forms 10G
                        CraigB
                        You bet! Glad I could help. Also, I've updated the Object Library in the article on the web so it is available if you want to download the updated library.

                        Craig...
                        • 9. Re: Disabled dates in a Calendar Picker in Forms 10G
                          arms777
                          Ok i will. Thanks again Mr. Craig.
                          • 10. Re: Disabled dates in a Calendar Picker in Forms 10G
                            arms777
                            I saw my username in your article... =) . Thanks man, I am truly honored. ☺