Bug Report T296665
Visible to All Users

ASPxTextBox - Requests cause unexpected behavior if a textbox has a date mask

created 9 years ago

Hello!

I've attached a sample project to reproduce the problem.
It looks strange to me that day-of-week part of masked text-box can have a different default value depending on the other parts of mask.

I see two scenarios, which are at least explainable:

  1. Current day of week (i.e. Monday at the moment)
  2. First day of week in the list of culture-dependent enumeration ( i.e. Sunday )

What I observe in fact is that default value can vary:  Fri, Mon, Sat, Sun

First of all, when you run the attached web-site, you'll see Fri010001.  I've done some javascript debugging and there is a line you use to create new Date (and then store it in "bag") to be used for overall date validness checking.

JavaScript
SetDate: function(maskInfo, date) { if(date == null) date = new Date(100, 0, 1); // ... etc

and it yields "Fri Jan 01 100 00:00:00 GMT+0200 (FLE Standard Time)"

The point is that these lines of code are not always called. This on depends on whether FixLastDatePart function is called or not, which in turn depends on presence of specific mask-parts.

Now, if you press button with text "Bug #2" you'll see day of week changing to Mon (I've debugged this part as well and in general the reason is because today is Monday).
If you press it again, it will change to Sat.
I've also played with different masks and sometimes I got Sun (and I thinks it's OK, so I don't post this scenario)

Overall, I find it wrong that default days of week can be that much variable.
In my project and don't even change the mask and after several callbacks Mon changes to Fri (still can't reproduce this in sample project)
And from the customer perspective I think it may be confusing that the pre-filled value is Friday.

Also, if you press button "Bug #1" twice you'll get an exception. I think it's a separate bug.

C#
[ArgumentOutOfRangeException: Year must be between 1 and 9999. Parameter name: year]

Thanks!

Comments (1)
Anthony (DevExpress Support) 9 years ago

    Hello Artur,

    I've reproduced this issue and forwarded it to our developers for further investigation. We will update this report once any news regarding this subject is available.

    Answers approved by DevExpress Support

    created 9 years ago (modified 9 years ago)

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

    Additional information:

    We fixed the server-side error (issue#1) in our code. As for the second issue, it is necessary to disable the editor's ViewState to resolve it.

      Comments (2)

        Thanks, but I'm not sure we can disable view-state in all our text-boxes with datetime masks. I mean, this probably requires some additional efforts to sort out all kinds of problem that may occur, and I can do this on my form, but there's no way I can force everybody keeping this in mind in future.
        Why can't this bug be fixed with enabled view-state?

        DevExpress Support Team 9 years ago

          Hi,

          Masks are contained in the ViewState. Since the ViewState cannot be changed on a callback, the internal validation mechanism fails and the issue occurs. This behavior is scenario-specific and can't be fixed on our side. So, as a workaround, we suggest you disable the ViewState of the text boxes.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.