Ticket S139013
Visible to All Users

ASPxTextBox - Add Email address format validator

created 13 years ago

Similar to the IsRequired validator
I would estimate at least 90% of business applications would benefit from this suggestion.

Show previous comments (2)
DevExpress Support Team 13 years ago

    Hello Duke:
    Yes, the built-in regex validator allows validating emails.
    Moreover, you can set a corresponding regular expression automatically when you select it from the list of pre-defined patterns.
    I have attached screencasts that illustrate how to accomplish this task.
    Thanks
    Kate.

      Hi Kate,
      Thanks for the reply…
      I'm not seeing the same experience you're showing me… I'm accessing the Properties editor in source view as my textbox control is in a gridview edit form.
      Here is the code that I had to implement in order to validate a required email and email address format. Note that I had to enter my own regular expression.
                                                      <dx:ASPxTextBox ID="tbxEmail" Text='<%# Bind("Email") %>' ErrorDisplayMode="Text">
                                                          <ValidationSettings SetFocusOnError="True" ValidationGroup="EditForm" Display="Dynamic" ErrorTextPosition="Bottom">
                                                              <RequiredField IsRequired="True" ErrorText="Required" />
                                                              <RegularExpression ErrorText="Invalid Email Format" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*.\w+([-.]\w+)*" />
                                                          </ValidationSettings>
                                                      </dx:ASPxTextBox>
      QUESTION: How do I implement an email validator as you recommend?
      Thanks,
      -Duke

      DevExpress Support Team 13 years ago

        Hello Duke:
        The attached markup illustrates that you have already implemented the regex email validation for the ASPxTextBox and your regular expression looks correct.
        Unless I am mistaken, you use this textbox in the EditFormTemplate container of the ASPxGridView. Please take a look at the following article to learn more how to execute automatic validation of the customized edit form when you click Update:
        Edit Form Validation (Templates)
        Your feedback is highly appreciated.
        Thanks
        Kate.

        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.