Ticket T836105
Visible to All Users

GridView - Numeric values are treated as invalid while updating row values using mask validation

created 5 years ago (modified 5 years ago)

[DevExpress Support Team: CLONED FROM T828978: Validation - Non-string values are incorrectly interpreted as invalid using mask validation rules while updating row values]

This problem is still happening on our phone number fields, see below for column definition.

HTML
<dx:GridViewDataTextColumn FieldName="PhoneCellNumeric" Caption="Mobile" Width="110px"> <PropertiesTextEdit Width="110px" DisplayFormatString="{0:(###) ###-####}"> <MaskSettings Mask="(000) 000-0000" IncludeLiterals="None" /> <ClientSideEvents Validation="dxPhoneValidation" /> </PropertiesTextEdit> <CellStyle HorizontalAlign="Left" /> <EditFormSettings VisibleIndex="7" ColumnSpan="2" /> </dx:GridViewDataTextColumn>
Comments (2)
DevExpress Support Team 5 years ago

    Hello,
    I created a sample project where I used a text column with exactly your column's settings and tested this project in version 19.2.4 (this version contains the fix we applied in the scope of the Validation - Non-string values are incorrectly interpreted as invalid using mask validation rules while updating row values thread).

    I was not able to reproduce the issue with submitting row values using my sample project. Please see the video attached.
    Please check how the attached sample operates on your side. Did I miss anything important?

    In this case, please add required modifications to my sample and send it back to me. Also, describe steps I should perform with my sample in order to replicate the problematic behavior.
    We will investigate it and do our best to assist you.

      Thank you for the sample project. When I run the solution, the grid loads fine. However, if i remove the phone number I get the error icon (see attachment). I added to your solution the code below to ensure the field is not required and I still get the error when deleting the phone number. I need to make that field not required, what am I missing?

      ASPx
      : : : <dx:GridViewDataTextColumn FieldName="Phone" Caption="Mobile" Width="110px"> <PropertiesTextEdit Width="110px" DisplayFormatString="{0:(###) ###-####}"> <MaskSettings Mask="(000) 000-0000" IncludeLiterals="None" /> <ValidationSettings ErrorDisplayMode="ImageWithText"> <RequiredField IsRequired="false" /> </ValidationSettings> </PropertiesTextEdit> <CellStyle HorizontalAlign="Left" /> </dx:GridViewDataTextColumn> : : :

      Answers approved by DevExpress Support

      created 5 years ago

      Hello,
      The issue occurs because your mask contains 0 characters. They specify the required digits as described in the Mask Types article.
      So, when you clear the editor value, it becomes invalid.
      In your scenario, you need to specify your mask with optional digists (9). For example:

      ASPx
      <PropertiesTextEdit Width="110px" DisplayFormatString="{0:(###) ###-####}"> <MaskSettings Mask="(999) 999-9999" IncludeLiterals="None" /> </PropertiesTextEdit>

      Please try this and let me know your results.

        Comments (2)

          That was it, thank you very much.

          DevExpress Support Team 5 years ago

            You are welcome!
            I am happy to hear that my assistance was helpful to you.

            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.