7 Replies Latest reply on Sep 10, 2007 9:06 AM by dimival

    DateField Problem

    Santanu Karar Level 1

      I've just found a problem , maybe a bug, in DateField component.

      Suppose, you've a DateField with current date in it, now you click the calendar icon beside the text box, click on the current selected date, the DateField should show the current date still, now do the process for another time. The DateField now shows blank! .. and if you catches the change in debugger, you can get null value!

      Does any workout is there..?


        • 1. Re: DateField Problem
          dimival Level 1
          I think that's the normal behavior, first click selects second click unselects. Think of the following example:

          Suppose you have a form with an optional date field, if you select a date and before submitting the form you decide not to include the date (it's an optional field), you need someway to unselect the DateField, and that way is to click again on the selected date, to unselect it.

          • 2. Re: DateField Problem
            Santanu Karar Level 1
            But what if an dateField is responsible for filtering datas? Then I'll need to code extra texts in my filtering algo!
            • 3. Re: DateField Problem
              dimival Level 1
              Sorry i didn't get your example. The thing is the behavior you described in your first post is the default and normal one, one click selects the date, a second click con the selected date unselects it, think of it as a checkbox.
              • 4. Re: DateField Problem
                Santanu Karar Level 1
                My app uses a DateField as a filtering option to a datagrid. So, when the dateField comes first with the current or any specific dates, the grid recos coming accordingly.. bt if i click twice in current date, then filteing just vanished and grid shows all the recos. Might be a normal behavior to dateField..! But this might treat problemtic to some cases like this.
                • 5. Re: DateField Problem
                  dimival Level 1
                  Don't see the point in clicking twice on the selectedDate but never mind that.

                  So i think you can prevent this from happening, you will need a listener for the change event. The CalendarLayoutChangeEvent (change event dispatched by the dateField) has a property named newDate which is the new selectedDate, you will need to check if the new date is null, then you will need to prevent the event's behavior by using the preventDefault method on the event.

                  I am not 100% sure this will work but i did something similar to prevent drag 'n drop from happening between two datagrids so i am assuming you can prevent the DateField's change event. Give it a shot and let me know if it worked

                  • 6. DateField Problem
                    Santanu Karar Level 1
                    Ya sure! I'm sure that it'll work. :) though I didn't want to write extra checking in my code. But anyway, there's no other way!.. and I have to do that! Maybe an extra checking could do my work!

                    :) thanks.
                    • 7. Re: DateField Problem
                      dimival Level 1
                      Glad to help :)